2017-02-13 14:01:54 -05:00
|
|
|
#!/usr/bin/env bash
|
2016-05-27 17:26:37 -04:00
|
|
|
set -e
|
|
|
|
|
|
|
|
# This file is used to auto-generate Dockerfiles for making debs via 'make deb'
|
|
|
|
#
|
|
|
|
# usage: ./generate.sh [versions]
|
|
|
|
# ie: ./generate.sh
|
|
|
|
# to update all Dockerfiles in this directory
|
|
|
|
# or: ./generate.sh ubuntu-xenial
|
|
|
|
# to only update ubuntu-xenial/Dockerfile
|
|
|
|
# or: ./generate.sh ubuntu-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
|
|
|
|
echo "${versions[@]}"
|
|
|
|
distro="${version%-*}"
|
|
|
|
suite="${version##*-}"
|
|
|
|
from="ppc64le/${distro}:${suite}"
|
|
|
|
|
|
|
|
mkdir -p "$version"
|
|
|
|
echo "$version -> FROM $from"
|
|
|
|
cat > "$version/Dockerfile" <<-EOF
|
|
|
|
#
|
|
|
|
# THIS FILE IS AUTOGENERATED; SEE "contrib/builder/deb/ppc64le/generate.sh"!
|
|
|
|
#
|
|
|
|
|
|
|
|
FROM $from
|
|
|
|
|
|
|
|
EOF
|
|
|
|
|
|
|
|
extraBuildTags='pkcs11'
|
|
|
|
runcBuildTags=
|
|
|
|
|
|
|
|
# this list is sorted alphabetically; please keep it that way
|
|
|
|
packages=(
|
|
|
|
apparmor # for apparmor_parser for testing the profile
|
|
|
|
bash-completion # for bash-completion debhelper integration
|
|
|
|
btrfs-tools # for "btrfs/ioctl.h" (and "version.h" if possible)
|
|
|
|
build-essential # "essential for building Debian packages"
|
2016-11-09 13:47:31 -05:00
|
|
|
cmake # tini dep
|
2016-05-27 17:26:37 -04:00
|
|
|
curl ca-certificates # for downloading Go
|
|
|
|
debhelper # for easy ".deb" building
|
|
|
|
dh-apparmor # for apparmor debhelper
|
|
|
|
dh-systemd # for systemd debhelper integration
|
|
|
|
git # for "git commit" info in "docker -v"
|
|
|
|
libapparmor-dev # for "sys/apparmor.h"
|
|
|
|
libdevmapper-dev # for "libdevmapper.h"
|
|
|
|
libltdl-dev # for pkcs11 "ltdl.h"
|
|
|
|
pkg-config # for detecting things like libsystemd-journal dynamically
|
2016-11-09 13:47:31 -05:00
|
|
|
vim-common # tini dep
|
2016-05-27 17:26:37 -04:00
|
|
|
)
|
2016-09-16 16:25:54 -04:00
|
|
|
|
|
|
|
case "$suite" in
|
|
|
|
trusty)
|
|
|
|
packages+=( libsystemd-journal-dev )
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
# libseccomp isn't available until ubuntu xenial and is required for "seccomp.h" & "libseccomp.so"
|
|
|
|
packages+=( libseccomp-dev )
|
|
|
|
packages+=( libsystemd-dev )
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
# buildtags
|
2016-05-27 17:26:37 -04:00
|
|
|
case "$suite" in
|
2016-09-16 16:25:54 -04:00
|
|
|
# trusty has no seccomp package
|
|
|
|
trusty)
|
|
|
|
runcBuildTags="apparmor selinux"
|
|
|
|
;;
|
2016-05-27 17:26:37 -04:00
|
|
|
# ppc64le support was backported into libseccomp 2.2.3-2,
|
|
|
|
# so enable seccomp by default
|
|
|
|
*)
|
|
|
|
extraBuildTags+=' seccomp'
|
|
|
|
runcBuildTags="apparmor seccomp selinux"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
# update and install packages
|
|
|
|
echo "RUN apt-get update && apt-get install -y ${packages[*]} --no-install-recommends && rm -rf /var/lib/apt/lists/*" >> "$version/Dockerfile"
|
|
|
|
echo >> "$version/Dockerfile"
|
|
|
|
|
|
|
|
awk '$1 == "ENV" && $2 == "GO_VERSION" { print; exit }' ../../../../Dockerfile.ppc64le >> "$version/Dockerfile"
|
2016-12-07 16:49:46 -05:00
|
|
|
echo 'RUN curl -fsSL "https://golang.org/dl/go${GO_VERSION}.linux-ppc64le.tar.gz" | tar xzC /usr/local' >> "$version/Dockerfile"
|
2016-05-27 17:26:37 -04:00
|
|
|
echo 'ENV PATH $PATH:/usr/local/go/bin' >> "$version/Dockerfile"
|
|
|
|
echo >> "$version/Dockerfile"
|
|
|
|
|
|
|
|
echo 'ENV AUTO_GOPATH 1' >> "$version/Dockerfile"
|
|
|
|
echo >> "$version/Dockerfile"
|
|
|
|
|
|
|
|
# print build tags in alphabetical order
|
|
|
|
buildTags=$( echo "apparmor selinux $extraBuildTags" | xargs -n1 | sort -n | tr '\n' ' ' | sed -e 's/[[:space:]]*$//' )
|
|
|
|
echo "ENV DOCKER_BUILDTAGS $buildTags" >> "$version/Dockerfile"
|
|
|
|
echo "ENV RUNC_BUILDTAGS $runcBuildTags" >> "$version/Dockerfile"
|
|
|
|
done
|