github.com/damirazo/docker@v1.9.0/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 if [[ "$version" == "centos-7" ]]; then 43 echo 'RUN yum -y swap -- remove systemd-container systemd-container-libs -- install systemd systemd-libs' >> "$version/Dockerfile" 44 fi 45 ;; 46 oraclelinux:*) 47 # get "Development Tools" packages and dependencies 48 echo 'RUN yum groupinstall -y "Development Tools"' >> "$version/Dockerfile" 49 ;; 50 opensuse:*) 51 # get rpm-build and curl packages and dependencies 52 echo 'RUN zypper --non-interactive install ca-certificates* curl gzip rpm-build' >> "$version/Dockerfile" 53 ;; 54 *) 55 echo 'RUN yum install -y @development-tools fedora-packager' >> "$version/Dockerfile" 56 ;; 57 esac 58 59 # this list is sorted alphabetically; please keep it that way 60 packages=( 61 btrfs-progs-devel # for "btrfs/ioctl.h" (and "version.h" if possible) 62 device-mapper-devel # for "libdevmapper.h" 63 glibc-static 64 libselinux-devel # for "libselinux.so" 65 selinux-policy 66 selinux-policy-devel 67 sqlite-devel # for "sqlite3.h" 68 tar # older versions of dev-tools do not have tar 69 ) 70 71 case "$from" in 72 oraclelinux:7) 73 # Enable the optional repository 74 packages=( --enablerepo=ol7_optional_latest "${packages[*]}" ) 75 ;; 76 esac 77 78 case "$from" in 79 opensuse:*) 80 packages=( "${packages[@]/btrfs-progs-devel/libbtrfs-devel}" ) 81 # use zypper 82 echo "RUN zypper --non-interactive install ${packages[*]}" >> "$version/Dockerfile" 83 ;; 84 *) 85 echo "RUN yum install -y ${packages[*]}" >> "$version/Dockerfile" 86 ;; 87 esac 88 89 echo >> "$version/Dockerfile" 90 91 awk '$1 == "ENV" && $2 == "GO_VERSION" { print; exit }' ../../../Dockerfile >> "$version/Dockerfile" 92 echo 'RUN curl -fSL "https://storage.googleapis.com/golang/go${GO_VERSION}.linux-amd64.tar.gz" | tar xzC /usr/local' >> "$version/Dockerfile" 93 echo 'ENV PATH $PATH:/usr/local/go/bin' >> "$version/Dockerfile" 94 95 echo >> "$version/Dockerfile" 96 97 echo 'ENV AUTO_GOPATH 1' >> "$version/Dockerfile" 98 99 echo 'ENV DOCKER_BUILDTAGS selinux' >> "$version/Dockerfile" 100 done