github.com/tych0/moby@v1.13.1/contrib/builder/deb/aarch64/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-trusty 10 # to only update ubuntu-trusty/Dockerfile 11 # or: ./generate.sh ubuntu-newversion 12 # to create a new folder and a Dockerfile within it 13 # 14 # Note: non-LTS versions are not guaranteed to work. 15 16 cd "$(dirname "$(readlink -f "$BASH_SOURCE")")" 17 18 versions=( "$@" ) 19 if [ ${#versions[@]} -eq 0 ]; then 20 versions=( */ ) 21 fi 22 versions=( "${versions[@]%/}" ) 23 24 for version in "${versions[@]}"; do 25 echo "${versions[@]}" 26 distro="${version%-*}" 27 suite="${version##*-}" 28 from="aarch64/${distro}:${suite}" 29 30 mkdir -p "$version" 31 echo "$version -> FROM $from" 32 cat > "$version/Dockerfile" <<-EOF 33 # 34 # THIS FILE IS AUTOGENERATED; SEE "contrib/builder/deb/aarch64/generate.sh"! 35 # 36 37 FROM $from 38 39 EOF 40 41 dockerBuildTags='apparmor pkcs11 selinux' 42 runcBuildTags='apparmor selinux' 43 44 # this list is sorted alphabetically; please keep it that way 45 packages=( 46 apparmor # for apparmor_parser for testing the profile 47 bash-completion # for bash-completion debhelper integration 48 btrfs-tools # for "btrfs/ioctl.h" (and "version.h" if possible) 49 build-essential # "essential for building Debian packages" 50 cmake # tini dep 51 curl ca-certificates # for downloading Go 52 debhelper # for easy ".deb" building 53 dh-apparmor # for apparmor debhelper 54 dh-systemd # for systemd debhelper integration 55 git # for "git commit" info in "docker -v" 56 libapparmor-dev # for "sys/apparmor.h" 57 libdevmapper-dev # for "libdevmapper.h" 58 libltdl-dev # for pkcs11 "ltdl.h" 59 libsqlite3-dev # for "sqlite3.h" 60 pkg-config # for detecting things like libsystemd-journal dynamically 61 vim-common # tini dep 62 ) 63 64 case "$suite" in 65 trusty) 66 packages+=( libsystemd-journal-dev ) 67 # aarch64 doesn't have an official downloadable binary for go. 68 # And gccgo for trusty only includes Go 1.2 implementation which 69 # is too old to build current go source, fortunately trusty has 70 # golang-1.6-go package can be used as bootstrap. 71 packages+=( golang-1.6-go ) 72 ;; 73 xenial) 74 packages+=( libsystemd-dev ) 75 packages+=( golang-go libseccomp-dev) 76 77 dockerBuildTags="$dockerBuildTags seccomp" 78 runcBuildTags="$runcBuildTags seccomp" 79 ;; 80 *) 81 echo "Unsupported distro:" $distro:$suite 82 rm -fr "$version" 83 exit 1 84 ;; 85 esac 86 87 # update and install packages 88 echo "RUN apt-get update && apt-get install -y ${packages[*]} --no-install-recommends && rm -rf /var/lib/apt/lists/*" >> "$version/Dockerfile" 89 echo >> "$version/Dockerfile" 90 91 case "$suite" in 92 trusty) 93 echo 'RUN update-alternatives --install /usr/bin/go go /usr/lib/go-1.6/bin/go 100' >> "$version/Dockerfile" 94 echo >> "$version/Dockerfile" 95 ;; 96 *) 97 ;; 98 esac 99 100 echo "# Install Go" >> "$version/Dockerfile" 101 echo "# aarch64 doesn't have official go binaries, so use the version of go installed from" >> "$version/Dockerfile" 102 echo "# the image to build go from source." >> "$version/Dockerfile" 103 104 awk '$1 == "ENV" && $2 == "GO_VERSION" { print; exit }' ../../../../Dockerfile.aarch64 >> "$version/Dockerfile" 105 echo 'RUN mkdir /usr/src/go && curl -fsSL https://golang.org/dl/go${GO_VERSION}.src.tar.gz | tar -v -C /usr/src/go -xz --strip-components=1 \' >> "$version/Dockerfile" 106 echo ' && cd /usr/src/go/src \' >> "$version/Dockerfile" 107 echo ' && GOOS=linux GOARCH=arm64 GOROOT_BOOTSTRAP="$(go env GOROOT)" ./make.bash' >> "$version/Dockerfile" 108 echo >> "$version/Dockerfile" 109 110 echo 'ENV PATH $PATH:/usr/src/go/bin' >> "$version/Dockerfile" 111 echo >> "$version/Dockerfile" 112 113 echo "ENV AUTO_GOPATH 1" >> "$version/Dockerfile" 114 echo >> "$version/Dockerfile" 115 116 echo "ENV DOCKER_BUILDTAGS $dockerBuildTags" >> "$version/Dockerfile" 117 echo "ENV RUNC_BUILDTAGS $runcBuildTags" >> "$version/Dockerfile" 118 done