github.com/tsuna/docker@v1.7.0-rc3/contrib/builder/deb/generate.sh (about) 1 #!/bin/bash 2 set -e 3 4 # usage: ./generate.sh [versions] 5 # ie: ./generate.sh 6 # to update all Dockerfiles in this directory 7 # or: ./generate.sh debian-jessie 8 # to only update debian-jessie/Dockerfile 9 # or: ./generate.sh debian-newversion 10 # to create a new folder and a Dockerfile within it 11 12 cd "$(dirname "$(readlink -f "$BASH_SOURCE")")" 13 14 versions=( "$@" ) 15 if [ ${#versions[@]} -eq 0 ]; then 16 versions=( */ ) 17 fi 18 versions=( "${versions[@]%/}" ) 19 20 for version in "${versions[@]}"; do 21 distro="${version%-*}" 22 suite="${version##*-}" 23 from="${distro}:${suite}" 24 25 mkdir -p "$version" 26 echo "$version -> FROM $from" 27 cat > "$version/Dockerfile" <<-EOF 28 # 29 # THIS FILE IS AUTOGENERATED; SEE "contrib/builder/deb/generate.sh"! 30 # 31 32 FROM $from 33 EOF 34 35 case "$from" in 36 debian:wheezy) 37 # add -backports, like our users have to 38 echo "RUN echo deb http://http.debian.net/debian $suite-backports main > /etc/apt/sources.list.d/$suite-backports.list" >> "$version/Dockerfile" 39 ;; 40 esac 41 42 echo >> "$version/Dockerfile" 43 44 # this list is sorted alphabetically; please keep it that way 45 packages=( 46 bash-completion # for bash-completion debhelper integration 47 btrfs-tools # for "btrfs/ioctl.h" (and "version.h" if possible) 48 build-essential # "essential for building Debian packages" 49 curl ca-certificates # for downloading Go 50 debhelper # for easy ".deb" building 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 libsqlite3-dev # for "sqlite3.h" 56 ) 57 echo "RUN apt-get update && apt-get install -y ${packages[*]} --no-install-recommends && rm -rf /var/lib/apt/lists/*" >> "$version/Dockerfile" 58 59 echo >> "$version/Dockerfile" 60 61 awk '$1 == "ENV" && $2 == "GO_VERSION" { print; exit }' ../../../Dockerfile >> "$version/Dockerfile" 62 echo 'RUN curl -fSL "https://storage.googleapis.com/golang/go${GO_VERSION}.linux-amd64.tar.gz" | tar xzC /usr/local' >> "$version/Dockerfile" 63 echo 'ENV PATH $PATH:/usr/local/go/bin' >> "$version/Dockerfile" 64 65 echo >> "$version/Dockerfile" 66 67 echo 'ENV AUTO_GOPATH 1' >> "$version/Dockerfile" 68 awk '$1 == "ENV" && $2 == "DOCKER_BUILDTAGS" { print; exit }' ../../../Dockerfile >> "$version/Dockerfile" 69 done