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
|
2015-12-19 18:27:02 -05:00
|
|
|
# to only update fedora-23/Dockerfile
|
2015-04-30 18:30:42 -04:00
|
|
|
# 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}"
|
2015-10-27 13:25:39 -04:00
|
|
|
installer=yum
|
2015-12-19 18:27:02 -05:00
|
|
|
if [[ "$distro" == "fedora" ]]; then
|
2015-10-27 13:25:39 -04:00
|
|
|
installer=dnf
|
|
|
|
fi
|
2015-04-30 18:30:42 -04:00
|
|
|
|
|
|
|
mkdir -p "$version"
|
|
|
|
echo "$version -> FROM $from"
|
|
|
|
cat > "$version/Dockerfile" <<-EOF
|
|
|
|
#
|
2015-11-23 14:00:43 -05:00
|
|
|
# THIS FILE IS AUTOGENERATED; SEE "contrib/builder/rpm/amd64/generate.sh"!
|
2015-04-30 18:30:42 -04:00
|
|
|
#
|
|
|
|
|
|
|
|
FROM $from
|
|
|
|
EOF
|
|
|
|
|
|
|
|
echo >> "$version/Dockerfile"
|
|
|
|
|
2015-11-14 21:02:08 -05:00
|
|
|
extraBuildTags=
|
2016-03-21 20:37:31 -04:00
|
|
|
runcBuildTags=
|
2015-11-14 21:02:08 -05:00
|
|
|
|
2015-04-30 18:30:42 -04:00
|
|
|
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
|
2016-01-07 16:09:47 -05:00
|
|
|
# we also need yum-utils for yum-config-manager to pull the latest repo file
|
2015-07-08 02:12:19 -04:00
|
|
|
echo 'RUN yum groupinstall -y "Development Tools"' >> "$version/Dockerfile"
|
|
|
|
;;
|
2015-09-15 16:13:22 -04:00
|
|
|
opensuse:*)
|
|
|
|
# get rpm-build and curl packages and dependencies
|
2015-09-23 07:48:06 -04:00
|
|
|
echo 'RUN zypper --non-interactive install ca-certificates* curl gzip rpm-build' >> "$version/Dockerfile"
|
2015-09-15 16:13:22 -04:00
|
|
|
;;
|
2015-04-30 18:30:42 -04:00
|
|
|
*)
|
2015-10-27 13:25:39 -04:00
|
|
|
echo "RUN ${installer} install -y @development-tools fedora-packager" >> "$version/Dockerfile"
|
2015-04-30 18:30:42 -04:00
|
|
|
;;
|
|
|
|
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
|
2015-11-14 21:02:08 -05:00
|
|
|
libseccomp-devel # for "seccomp.h" & "libseccomp.so"
|
2015-04-30 18:30:42 -04:00
|
|
|
libselinux-devel # for "libselinux.so"
|
2015-11-14 11:04:41 -05:00
|
|
|
libtool-ltdl-devel # for pkcs11 "ltdl.h"
|
2016-01-22 18:38:38 -05:00
|
|
|
pkgconfig # for the pkg-config command
|
2015-08-25 15:34:25 -04:00
|
|
|
selinux-policy
|
|
|
|
selinux-policy-devel
|
2015-04-30 18:30:42 -04:00
|
|
|
sqlite-devel # for "sqlite3.h"
|
2016-01-22 18:38:38 -05:00
|
|
|
systemd-devel # for "sd-journal.h" and libraries
|
2015-07-09 17:34:39 -04:00
|
|
|
tar # older versions of dev-tools do not have tar
|
2016-03-21 20:37:31 -04:00
|
|
|
git # required for containerd and runc clone
|
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
|
2015-09-15 16:13:22 -04:00
|
|
|
|
2016-01-22 18:38:38 -05:00
|
|
|
case "$from" in
|
|
|
|
oraclelinux:6)
|
|
|
|
# doesn't use systemd, doesn't have a devel package for it
|
|
|
|
packages=( "${packages[@]/systemd-devel}" )
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2015-11-14 21:02:08 -05:00
|
|
|
# opensuse & oraclelinx:6 do not have the right libseccomp libs
|
2015-12-29 00:25:11 -05:00
|
|
|
# centos:7 and oraclelinux:7 have a libseccomp < 2.2.1 :(
|
2015-11-14 21:02:08 -05:00
|
|
|
case "$from" in
|
2015-12-29 00:25:11 -05:00
|
|
|
opensuse:*|oraclelinux:*|centos:7)
|
2015-11-14 21:02:08 -05:00
|
|
|
packages=( "${packages[@]/libseccomp-devel}" )
|
2016-03-21 20:37:31 -04:00
|
|
|
runcBuildTags="selinux"
|
2015-11-14 21:02:08 -05:00
|
|
|
;;
|
|
|
|
*)
|
|
|
|
extraBuildTags+=' seccomp'
|
2016-03-21 20:37:31 -04:00
|
|
|
runcBuildTags="seccomp selinux"
|
2015-11-14 21:02:08 -05:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2015-09-15 16:13:22 -04:00
|
|
|
case "$from" in
|
|
|
|
opensuse:*)
|
|
|
|
packages=( "${packages[@]/btrfs-progs-devel/libbtrfs-devel}" )
|
2016-01-22 18:38:38 -05:00
|
|
|
packages=( "${packages[@]/pkgconfig/pkg-config}" )
|
2016-01-15 18:46:56 -05:00
|
|
|
if [[ "$from" == "opensuse:13."* ]]; then
|
|
|
|
packages+=( systemd-rpm-macros )
|
|
|
|
fi
|
|
|
|
|
2015-09-15 16:13:22 -04:00
|
|
|
# use zypper
|
2015-09-23 07:48:06 -04:00
|
|
|
echo "RUN zypper --non-interactive install ${packages[*]}" >> "$version/Dockerfile"
|
2015-09-15 16:13:22 -04:00
|
|
|
;;
|
|
|
|
*)
|
2015-10-27 13:25:39 -04:00
|
|
|
echo "RUN ${installer} install -y ${packages[*]}" >> "$version/Dockerfile"
|
2015-09-15 16:13:22 -04:00
|
|
|
;;
|
|
|
|
esac
|
2015-04-30 18:30:42 -04:00
|
|
|
|
|
|
|
echo >> "$version/Dockerfile"
|
|
|
|
|
2016-01-07 16:09:47 -05:00
|
|
|
case "$from" in
|
|
|
|
oraclelinux:6)
|
|
|
|
# We need a known version of the kernel-uek-devel headers to set CGO_CPPFLAGS, so grab the UEKR4 GA version
|
|
|
|
# This requires using yum-config-manager from yum-utils to enable the UEKR4 yum repo
|
|
|
|
echo "RUN yum install -y yum-utils && curl -o /etc/yum.repos.d/public-yum-ol6.repo http://yum.oracle.com/public-yum-ol6.repo && yum-config-manager -q --enable ol6_UEKR4" >> "$version/Dockerfile"
|
|
|
|
echo "RUN yum install -y kernel-uek-devel-4.1.12-32.el6uek" >> "$version/Dockerfile"
|
|
|
|
echo >> "$version/Dockerfile"
|
|
|
|
;;
|
|
|
|
*) ;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
|
2015-11-23 14:00:43 -05:00
|
|
|
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-11-14 21:02:08 -05:00
|
|
|
echo >> "$version/Dockerfile"
|
|
|
|
|
|
|
|
# print build tags in alphabetical order
|
|
|
|
buildTags=$( echo "selinux $extraBuildTags" | xargs -n1 | sort -n | tr '\n' ' ' | sed -e 's/[[:space:]]*$//' )
|
|
|
|
|
|
|
|
echo "ENV DOCKER_BUILDTAGS $buildTags" >> "$version/Dockerfile"
|
2016-03-21 20:37:31 -04:00
|
|
|
echo "ENV RUNC_BUILDTAGS $runcBuildTags" >> "$version/Dockerfile"
|
2016-01-07 16:09:47 -05:00
|
|
|
echo >> "$version/Dockerfile"
|
|
|
|
|
|
|
|
case "$from" in
|
|
|
|
oraclelinux:6)
|
|
|
|
# We need to set the CGO_CPPFLAGS environment to use the updated UEKR4 headers with all the userns stuff.
|
|
|
|
# The ordering is very important and should not be changed.
|
|
|
|
echo 'ENV CGO_CPPFLAGS -D__EXPORTED_HEADERS__ \' >> "$version/Dockerfile"
|
|
|
|
echo ' -I/usr/src/kernels/4.1.12-32.el6uek.x86_64/arch/x86/include/generated/uapi \' >> "$version/Dockerfile"
|
|
|
|
echo ' -I/usr/src/kernels/4.1.12-32.el6uek.x86_64/arch/x86/include/uapi \' >> "$version/Dockerfile"
|
|
|
|
echo ' -I/usr/src/kernels/4.1.12-32.el6uek.x86_64/include/generated/uapi \' >> "$version/Dockerfile"
|
|
|
|
echo ' -I/usr/src/kernels/4.1.12-32.el6uek.x86_64/include/uapi \' >> "$version/Dockerfile"
|
|
|
|
echo ' -I/usr/src/kernels/4.1.12-32.el6uek.x86_64/include' >> "$version/Dockerfile"
|
|
|
|
echo >> "$version/Dockerfile"
|
|
|
|
;;
|
|
|
|
*) ;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
|
2015-04-30 18:30:42 -04:00
|
|
|
done
|