From 64881dc331f1f0ff861eb82bb05eef63d6693a67 Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Fri, 27 May 2016 17:26:37 -0400 Subject: [PATCH] ppc64le: add support for building docker debs for xenial This PR adds the ability to make docker debs for xenial on power Signed-off-by: Christopher Jones Signed-off-by: Christopher Jones --- contrib/builder/deb/ppc64le/build.sh | 10 ++ contrib/builder/deb/ppc64le/generate.sh | 100 ++++++++++++++++++ .../deb/ppc64le/ubuntu-xenial/Dockerfile | 24 +++++ man/Dockerfile.ppc64le | 25 +++++ 4 files changed, 159 insertions(+) create mode 100755 contrib/builder/deb/ppc64le/build.sh create mode 100755 contrib/builder/deb/ppc64le/generate.sh create mode 100644 contrib/builder/deb/ppc64le/ubuntu-xenial/Dockerfile create mode 100644 man/Dockerfile.ppc64le diff --git a/contrib/builder/deb/ppc64le/build.sh b/contrib/builder/deb/ppc64le/build.sh new file mode 100755 index 0000000000..7d22e8c47f --- /dev/null +++ b/contrib/builder/deb/ppc64le/build.sh @@ -0,0 +1,10 @@ +#!/bin/bash +set -e + +cd "$(dirname "$(readlink -f "$BASH_SOURCE")")" + +set -x +./generate.sh +for d in */; do + docker build -t "dockercore/builder-deb:$(basename "$d")" "$d" +done diff --git a/contrib/builder/deb/ppc64le/generate.sh b/contrib/builder/deb/ppc64le/generate.sh new file mode 100755 index 0000000000..3acf7e7d22 --- /dev/null +++ b/contrib/builder/deb/ppc64le/generate.sh @@ -0,0 +1,100 @@ +#!/bin/bash +set -e + +# This file is used to auto-generate Dockerfiles for making debs via 'make deb' +# +# usage: ./generate.sh [versions] +# ie: ./generate.sh +# to update all Dockerfiles in this directory +# or: ./generate.sh ubuntu-xenial +# to only update ubuntu-xenial/Dockerfile +# or: ./generate.sh ubuntu-newversion +# to create a new folder and a Dockerfile within it + +cd "$(dirname "$(readlink -f "$BASH_SOURCE")")" + +versions=( "$@" ) +if [ ${#versions[@]} -eq 0 ]; then + versions=( */ ) +fi +versions=( "${versions[@]%/}" ) + +for version in "${versions[@]}"; do + echo "${versions[@]}" + distro="${version%-*}" + suite="${version##*-}" + from="ppc64le/${distro}:${suite}" + + mkdir -p "$version" + echo "$version -> FROM $from" + cat > "$version/Dockerfile" <<-EOF + # + # THIS FILE IS AUTOGENERATED; SEE "contrib/builder/deb/ppc64le/generate.sh"! + # + + FROM $from + + EOF + + extraBuildTags='pkcs11' + runcBuildTags= + + # this list is sorted alphabetically; please keep it that way + packages=( + apparmor # for apparmor_parser for testing the profile + bash-completion # for bash-completion debhelper integration + btrfs-tools # for "btrfs/ioctl.h" (and "version.h" if possible) + build-essential # "essential for building Debian packages" + curl ca-certificates # for downloading Go + debhelper # for easy ".deb" building + dh-apparmor # for apparmor debhelper + dh-systemd # for systemd debhelper integration + git # for "git commit" info in "docker -v" + golang-go # ppc64le needs go to bootstrap go + libapparmor-dev # for "sys/apparmor.h" + libdevmapper-dev # for "libdevmapper.h" + libltdl-dev # for pkcs11 "ltdl.h" + libseccomp-dev # for "seccomp.h" & "libseccomp.so" + libsqlite3-dev # for "sqlite3.h" + libsystemd-dev + pkg-config # for detecting things like libsystemd-journal dynamically + ) + + case "$suite" in + # ppc64le support was backported into libseccomp 2.2.3-2, + # so enable seccomp by default + *) + extraBuildTags+=' seccomp' + runcBuildTags="apparmor seccomp selinux" + ;; + esac + + # update and install packages + echo "RUN apt-get update && apt-get install -y ${packages[*]} --no-install-recommends && rm -rf /var/lib/apt/lists/*" >> "$version/Dockerfile" + echo >> "$version/Dockerfile" + + # ppc64le doesn't have an official downloadable binary as of go 1.6.2. so use the + # older packaged go(v1.6.1) to bootstrap latest go, then remove the packaged go + awk '$1 == "ENV" && $2 == "GO_VERSION" { print; exit }' ../../../../Dockerfile.ppc64le >> "$version/Dockerfile" + echo 'ENV GO_DOWNLOAD_URL https://golang.org/dl/go${GO_VERSION}.src.tar.gz' >> "$version/Dockerfile" + echo 'ENV GOROOT_BOOTSTRAP /usr/lib/go-1.6' >> "$version/Dockerfile" + echo >> "$version/Dockerfile" + + echo 'RUN curl -fsSL "$GO_DOWNLOAD_URL" -o golang.tar.gz \' >> "$version/Dockerfile" + echo ' && tar -C /usr/local -xzf golang.tar.gz \' >> "$version/Dockerfile" + echo ' && rm golang.tar.gz \' >> "$version/Dockerfile" + echo ' && cd /usr/local/go/src && ./make.bash 2>&1 \' >> "$version/Dockerfile" + echo ' && apt-get purge -y golang-go && apt-get autoremove -y' >> "$version/Dockerfile" + echo >> "$version/Dockerfile" + + echo 'ENV PATH $PATH:/usr/local/go/bin' >> "$version/Dockerfile" + echo >> "$version/Dockerfile" + + echo 'ENV AUTO_GOPATH 1' >> "$version/Dockerfile" + echo >> "$version/Dockerfile" + + # print build tags in alphabetical order + buildTags=$( echo "apparmor selinux $extraBuildTags" | xargs -n1 | sort -n | tr '\n' ' ' | sed -e 's/[[:space:]]*$//' ) + echo "ENV DOCKER_BUILDTAGS $buildTags" >> "$version/Dockerfile" + echo "ENV RUNC_BUILDTAGS $runcBuildTags" >> "$version/Dockerfile" +done diff --git a/contrib/builder/deb/ppc64le/ubuntu-xenial/Dockerfile b/contrib/builder/deb/ppc64le/ubuntu-xenial/Dockerfile new file mode 100644 index 0000000000..a7da27a38a --- /dev/null +++ b/contrib/builder/deb/ppc64le/ubuntu-xenial/Dockerfile @@ -0,0 +1,24 @@ +# +# THIS FILE IS AUTOGENERATED; SEE "contrib/builder/deb/ppc64le/generate.sh"! +# + +FROM ppc64le/ubuntu:xenial + +RUN apt-get update && apt-get install -y apparmor bash-completion btrfs-tools build-essential curl ca-certificates debhelper dh-apparmor dh-systemd git golang-go libapparmor-dev libdevmapper-dev libltdl-dev libseccomp-dev libsqlite3-dev libsystemd-dev pkg-config --no-install-recommends && rm -rf /var/lib/apt/lists/* + +ENV GO_VERSION 1.6.3 +ENV GO_DOWNLOAD_URL https://golang.org/dl/go${GO_VERSION}.src.tar.gz +ENV GOROOT_BOOTSTRAP /usr/lib/go-1.6 + +RUN curl -fsSL "$GO_DOWNLOAD_URL" -o golang.tar.gz \ + && tar -C /usr/local -xzf golang.tar.gz \ + && rm golang.tar.gz \ + && cd /usr/local/go/src && ./make.bash 2>&1 \ + && apt-get purge -y golang-go && apt-get autoremove -y + +ENV PATH $PATH:/usr/local/go/bin + +ENV AUTO_GOPATH 1 + +ENV DOCKER_BUILDTAGS apparmor pkcs11 seccomp selinux +ENV RUNC_BUILDTAGS apparmor seccomp selinux diff --git a/man/Dockerfile.ppc64le b/man/Dockerfile.ppc64le new file mode 100644 index 0000000000..4ae0eeee82 --- /dev/null +++ b/man/Dockerfile.ppc64le @@ -0,0 +1,25 @@ +FROM ppc64le/ubuntu:xenial + +RUN apt-get update && apt-get install -y git golang-go + +RUN mkdir -p /go/src /go/bin /go/pkg +ENV GOPATH=/go:/usr/lib/go-1.6 +RUN export GLIDE=v0.11.1; \ + export TARGET=/go/src/github.com/Masterminds; \ + mkdir -p ${TARGET} && \ + git clone https://github.com/Masterminds/glide.git ${TARGET}/glide && \ + cd ${TARGET}/glide && \ + git checkout $GLIDE && \ + make build && \ + cp ./glide /usr/bin/glide && \ + cd / && rm -rf /go/src/* /go/bin/* /go/pkg/* + +COPY glide.yaml /manvendor/ +COPY glide.lock /manvendor/ +WORKDIR /manvendor/ +RUN glide install && mv vendor src +ENV GOPATH=$GOPATH:/go/src/github.com/docker/docker/vendor:/manvendor +RUN go build -o /usr/bin/go-md2man github.com/cpuguy83/go-md2man + +WORKDIR /go/src/github.com/docker/docker/ +ENTRYPOINT ["man/generate.sh"]