github.com/OpenFlowLabs/moby@v17.12.1-ce-rc2+incompatible/contrib/builder/deb/aarch64/generate.sh (about) 1 #!/usr/bin/env 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 extraBuildTags='apparmor 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 pkg-config # for detecting things like libsystemd-journal dynamically 59 vim-common # tini dep 60 ) 61 62 case "$suite" in 63 trusty) 64 packages+=( libsystemd-journal-dev ) 65 ;; 66 jessie) 67 packages+=( libsystemd-journal-dev ) 68 packages+=( libseccomp-dev ) 69 70 extraBuildTags+=' seccomp' 71 runcBuildTags+=' seccomp' 72 ;; 73 stretch|xenial) 74 packages+=( libsystemd-dev ) 75 packages+=( libseccomp-dev ) 76 77 extraBuildTags+=' seccomp' 78 runcBuildTags+=' seccomp' 79 ;; 80 *) 81 echo "Unsupported distro:" $distro:$suite 82 rm -fr "$version" 83 exit 1 84 ;; 85 esac 86 87 case "$suite" in 88 jessie) 89 echo 'RUN echo deb http://ftp.debian.org/debian jessie-backports main > /etc/apt/sources.list.d/backports.list' >> "$version/Dockerfile" 90 ;; 91 *) 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 awk '$1 == "ENV" && $2 == "GO_VERSION" { print; exit }' ../../../../Dockerfile.aarch64 >> "$version/Dockerfile" 100 echo 'RUN curl -fSL "https://golang.org/dl/go${GO_VERSION}.linux-arm64.tar.gz" | tar xzC /usr/local' >> "$version/Dockerfile" 101 echo 'ENV PATH $PATH:/usr/local/go/bin' >> "$version/Dockerfile" 102 echo >> "$version/Dockerfile" 103 104 echo 'ENV AUTO_GOPATH 1' >> "$version/Dockerfile" 105 echo >> "$version/Dockerfile" 106 107 # print build tags in alphabetical order 108 buildTags=$( echo "$extraBuildTags" | xargs -n1 | sort -n | tr '\n' ' ' | sed -e 's/[[:space:]]*$//' ) 109 runcBuildTags=$( echo "$runcBuildTags" | xargs -n1 | sort -n | tr '\n' ' ' | sed -e 's/[[:space:]]*$//' ) 110 echo "ENV DOCKER_BUILDTAGS $buildTags" >> "$version/Dockerfile" 111 echo "ENV RUNC_BUILDTAGS $runcBuildTags" >> "$version/Dockerfile" 112 done