2015-04-30 18:30:42 -04:00
|
|
|
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
|
|
|
|
# usage: ./generate.sh [versions]
|
|
|
|
# ie: ./generate.sh
|
|
|
|
# to update all Dockerfiles in this directory
|
|
|
|
# or: ./generate.sh
|
|
|
|
# to only update fedora-20/Dockerfile
|
|
|
|
# or: ./generate.sh fedora-newversion
|
|
|
|
# to create a new folder and a Dockerfile within it
|
|
|
|
|
|
|
|
cd "$(dirname "$(readlink -f "$BASH_SOURCE")")"
|
|
|
|
|
|
|
|
versions=( "$@" )
|
|
|
|
if [ ${#versions[@]} -eq 0 ]; then
|
|
|
|
versions=( */ )
|
|
|
|
fi
|
|
|
|
versions=( "${versions[@]%/}" )
|
|
|
|
|
|
|
|
for version in "${versions[@]}"; do
|
|
|
|
distro="${version%-*}"
|
|
|
|
suite="${version##*-}"
|
|
|
|
from="${distro}:${suite}"
|
|
|
|
|
|
|
|
mkdir -p "$version"
|
|
|
|
echo "$version -> FROM $from"
|
|
|
|
cat > "$version/Dockerfile" <<-EOF
|
|
|
|
#
|
|
|
|
# THIS FILE IS AUTOGENERATED; SEE "contrib/builder/rpm/generate.sh"!
|
|
|
|
#
|
|
|
|
|
|
|
|
FROM $from
|
|
|
|
EOF
|
|
|
|
|
|
|
|
echo >> "$version/Dockerfile"
|
|
|
|
|
|
|
|
case "$from" in
|
|
|
|
centos:*)
|
|
|
|
# get "Development Tools" packages dependencies
|
|
|
|
echo 'RUN yum groupinstall -y "Development Tools"' >> "$version/Dockerfile"
|
2015-07-06 17:14:26 -04:00
|
|
|
|
|
|
|
if [[ "$version" == "centos-7" ]]; then
|
|
|
|
echo 'RUN yum -y swap -- remove systemd-container systemd-container-libs -- install systemd systemd-libs' >> "$version/Dockerfile"
|
|
|
|
fi
|
2015-04-30 18:30:42 -04:00
|
|
|
;;
|
2015-07-08 02:12:19 -04:00
|
|
|
oraclelinux:*)
|
|
|
|
# get "Development Tools" packages and dependencies
|
|
|
|
echo 'RUN yum groupinstall -y "Development Tools"' >> "$version/Dockerfile"
|
|
|
|
;;
|
2015-04-30 18:30:42 -04:00
|
|
|
*)
|
|
|
|
echo 'RUN yum install -y @development-tools fedora-packager' >> "$version/Dockerfile"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
# this list is sorted alphabetically; please keep it that way
|
|
|
|
packages=(
|
|
|
|
btrfs-progs-devel # for "btrfs/ioctl.h" (and "version.h" if possible)
|
|
|
|
device-mapper-devel # for "libdevmapper.h"
|
|
|
|
glibc-static
|
|
|
|
libselinux-devel # for "libselinux.so"
|
|
|
|
sqlite-devel # for "sqlite3.h"
|
2015-07-09 17:34:39 -04:00
|
|
|
tar # older versions of dev-tools do not have tar
|
2015-04-30 18:30:42 -04:00
|
|
|
)
|
2015-07-09 17:34:39 -04:00
|
|
|
|
|
|
|
case "$from" in
|
|
|
|
oraclelinux:7)
|
|
|
|
# Enable the optional repository
|
|
|
|
packages=( --enablerepo=ol7_optional_latest "${packages[*]}" )
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
echo "RUN yum install -y ${packages[*]}" >> "$version/Dockerfile"
|
2015-04-30 18:30:42 -04:00
|
|
|
|
|
|
|
echo >> "$version/Dockerfile"
|
|
|
|
|
|
|
|
awk '$1 == "ENV" && $2 == "GO_VERSION" { print; exit }' ../../../Dockerfile >> "$version/Dockerfile"
|
2015-05-07 16:15:35 -04:00
|
|
|
echo 'RUN curl -fSL "https://storage.googleapis.com/golang/go${GO_VERSION}.linux-amd64.tar.gz" | tar xzC /usr/local' >> "$version/Dockerfile"
|
2015-04-30 18:30:42 -04:00
|
|
|
echo 'ENV PATH $PATH:/usr/local/go/bin' >> "$version/Dockerfile"
|
|
|
|
|
|
|
|
echo >> "$version/Dockerfile"
|
|
|
|
|
|
|
|
echo 'ENV AUTO_GOPATH 1' >> "$version/Dockerfile"
|
|
|
|
|
2015-07-20 19:21:33 -04:00
|
|
|
echo 'ENV DOCKER_BUILDTAGS selinux' >> "$version/Dockerfile"
|
2015-04-30 18:30:42 -04:00
|
|
|
done
|