github.com/vieux/docker@v0.6.3-0.20161004191708-e097c2a938c7/contrib/builder/deb/ppc64le/generate.sh (about) 1 #!/bin/bash 2 set -e 3 4 # This file is used to auto-generate Dockerfiles for making debs via 'make deb' 5 # 6 # usage: ./generate.sh [versions] 7 # ie: ./generate.sh 8 # to update all Dockerfiles in this directory 9 # or: ./generate.sh ubuntu-xenial 10 # to only update ubuntu-xenial/Dockerfile 11 # or: ./generate.sh ubuntu-newversion 12 # to create a new folder and a Dockerfile within it 13 14 cd "$(dirname "$(readlink -f "$BASH_SOURCE")")" 15 16 versions=( "$@" ) 17 if [ ${#versions[@]} -eq 0 ]; then 18 versions=( */ ) 19 fi 20 versions=( "${versions[@]%/}" ) 21 22 for version in "${versions[@]}"; do 23 echo "${versions[@]}" 24 distro="${version%-*}" 25 suite="${version##*-}" 26 from="ppc64le/${distro}:${suite}" 27 28 mkdir -p "$version" 29 echo "$version -> FROM $from" 30 cat > "$version/Dockerfile" <<-EOF 31 # 32 # THIS FILE IS AUTOGENERATED; SEE "contrib/builder/deb/ppc64le/generate.sh"! 33 # 34 35 FROM $from 36 37 EOF 38 39 extraBuildTags='pkcs11' 40 runcBuildTags= 41 42 # this list is sorted alphabetically; please keep it that way 43 packages=( 44 apparmor # for apparmor_parser for testing the profile 45 bash-completion # for bash-completion debhelper integration 46 btrfs-tools # for "btrfs/ioctl.h" (and "version.h" if possible) 47 build-essential # "essential for building Debian packages" 48 curl ca-certificates # for downloading Go 49 debhelper # for easy ".deb" building 50 dh-apparmor # for apparmor debhelper 51 dh-systemd # for systemd debhelper integration 52 git # for "git commit" info in "docker -v" 53 libapparmor-dev # for "sys/apparmor.h" 54 libdevmapper-dev # for "libdevmapper.h" 55 libltdl-dev # for pkcs11 "ltdl.h" 56 libsqlite3-dev # for "sqlite3.h" 57 pkg-config # for detecting things like libsystemd-journal dynamically 58 ) 59 60 # trusty uses a different go package name then xenial and newer, so track that for later 61 goPackage= 62 case "$suite" in 63 trusty) 64 # ppc64le doesn't have go binaries, so install go to bootstrap go 65 # trusty doesn't have a ppc64le golang-go package 66 packages+=( golang-1.6 ) 67 goPackage='golang-1.6' 68 69 packages+=( libsystemd-journal-dev ) 70 ;; 71 *) 72 # libseccomp isn't available until ubuntu xenial and is required for "seccomp.h" & "libseccomp.so" 73 packages+=( golang-go ) 74 goPackage='golang-go' 75 76 packages+=( libseccomp-dev ) 77 packages+=( libsystemd-dev ) 78 ;; 79 esac 80 81 # buildtags 82 case "$suite" in 83 # trusty has no seccomp package 84 trusty) 85 runcBuildTags="apparmor selinux" 86 ;; 87 # ppc64le support was backported into libseccomp 2.2.3-2, 88 # so enable seccomp by default 89 *) 90 extraBuildTags+=' seccomp' 91 runcBuildTags="apparmor seccomp selinux" 92 ;; 93 esac 94 95 # update and install packages 96 echo "RUN apt-get update && apt-get install -y ${packages[*]} --no-install-recommends && rm -rf /var/lib/apt/lists/*" >> "$version/Dockerfile" 97 echo >> "$version/Dockerfile" 98 99 # ppc64le doesn't have an official downloadable binary as of go 1.6.2. so use the 100 # older packaged go(v1.6.1) to bootstrap latest go, then remove the packaged go 101 echo "# Install Go" >> "$version/Dockerfile" 102 echo "# ppc64le doesn't have official go binaries, so use the version of go installed from the image" >> "$version/Dockerfile" 103 echo "# to build go from source." >> "$version/Dockerfile" 104 echo "# NOTE: ppc64le has compatibility issues with older versions of go, so make sure the version >= 1.6" >> "$version/Dockerfile" 105 106 awk '$1 == "ENV" && $2 == "GO_VERSION" { print; exit }' ../../../../Dockerfile.ppc64le >> "$version/Dockerfile" 107 echo 'ENV GO_DOWNLOAD_URL https://storage.googleapis.com/golang/go${GO_VERSION}.src.tar.gz' >> "$version/Dockerfile" 108 echo 'ENV GOROOT_BOOTSTRAP /usr/lib/go-1.6' >> "$version/Dockerfile" 109 echo >> "$version/Dockerfile" 110 111 echo 'RUN curl -fsSL "$GO_DOWNLOAD_URL" -o golang.tar.gz \' >> "$version/Dockerfile" 112 echo ' && tar -C /usr/local -xzf golang.tar.gz \' >> "$version/Dockerfile" 113 echo ' && rm golang.tar.gz \' >> "$version/Dockerfile" 114 echo ' && cd /usr/local/go/src && ./make.bash 2>&1 \' >> "$version/Dockerfile" 115 echo " && apt-get purge -y $goPackage && apt-get autoremove -y" >> "$version/Dockerfile" 116 echo >> "$version/Dockerfile" 117 118 echo 'ENV PATH $PATH:/usr/local/go/bin' >> "$version/Dockerfile" 119 echo >> "$version/Dockerfile" 120 121 echo 'ENV AUTO_GOPATH 1' >> "$version/Dockerfile" 122 echo >> "$version/Dockerfile" 123 124 # print build tags in alphabetical order 125 buildTags=$( echo "apparmor selinux $extraBuildTags" | xargs -n1 | sort -n | tr '\n' ' ' | sed -e 's/[[:space:]]*$//' ) 126 echo "ENV DOCKER_BUILDTAGS $buildTags" >> "$version/Dockerfile" 127 echo "ENV RUNC_BUILDTAGS $runcBuildTags" >> "$version/Dockerfile" 128 done