github.com/tsuna/docker@v1.7.0-rc3/contrib/builder/rpm/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 8 # to only update fedora-20/Dockerfile 9 # or: ./generate.sh fedora-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/rpm/generate.sh"! 30 # 31 32 FROM $from 33 EOF 34 35 echo >> "$version/Dockerfile" 36 37 case "$from" in 38 centos:*) 39 # get "Development Tools" packages dependencies 40 echo 'RUN yum groupinstall -y "Development Tools"' >> "$version/Dockerfile" 41 ;; 42 *) 43 echo 'RUN yum install -y @development-tools fedora-packager' >> "$version/Dockerfile" 44 ;; 45 esac 46 47 # this list is sorted alphabetically; please keep it that way 48 packages=( 49 btrfs-progs-devel # for "btrfs/ioctl.h" (and "version.h" if possible) 50 device-mapper-devel # for "libdevmapper.h" 51 glibc-static 52 libselinux-devel # for "libselinux.so" 53 sqlite-devel # for "sqlite3.h" 54 tar # older versions of dev-tools don't have tar 55 ) 56 echo "RUN yum install -y ${packages[*]}" >> "$version/Dockerfile" 57 58 echo >> "$version/Dockerfile" 59 60 awk '$1 == "ENV" && $2 == "GO_VERSION" { print; exit }' ../../../Dockerfile >> "$version/Dockerfile" 61 echo 'RUN curl -fSL "https://storage.googleapis.com/golang/go${GO_VERSION}.linux-amd64.tar.gz" | tar xzC /usr/local' >> "$version/Dockerfile" 62 echo 'ENV PATH $PATH:/usr/local/go/bin' >> "$version/Dockerfile" 63 64 echo >> "$version/Dockerfile" 65 66 echo 'ENV AUTO_GOPATH 1' >> "$version/Dockerfile" 67 68 if [ "$from" == "centos:6" ]; then 69 echo 'ENV DOCKER_BUILDTAGS selinux exclude_graphdriver_btrfs' >> "$version/Dockerfile" 70 else 71 echo 'ENV DOCKER_BUILDTAGS selinux' >> "$version/Dockerfile" 72 fi 73 done