diff --git a/centos-repo-install-test/Dockerfile b/centos-repo-install-test/Dockerfile index 3f536508..5cbddb08 100644 --- a/centos-repo-install-test/Dockerfile +++ b/centos-repo-install-test/Dockerfile @@ -1,6 +1,7 @@ ARG USER ARG REGISTRY=docker.io -FROM ${REGISTRY}/centos:centos8 +ARG UPSTREAM_DISTRO=centos:centos8 +FROM ${REGISTRY}/${UPSTREAM_DISTRO} # dnf-utils: for repoquery RUN dnf install -y \ @@ -9,4 +10,3 @@ RUN dnf install -y \ # Make additional development libraries available RUN yum config-manager --set-enabled PowerTools - diff --git a/centos8-build/Dockerfile b/centos8-build/Dockerfile index 46ce23ea..e71e03c5 100644 --- a/centos8-build/Dockerfile +++ b/centos8-build/Dockerfile @@ -1,5 +1,6 @@ ARG REGISTRY=docker.io -FROM ${REGISTRY}/centos:centos8 +ARG UPSTREAM_DISTRO=centos:centos8 +FROM ${REGISTRY}/${UPSTREAM_DISTRO} # Let package metadata expire after 60 seconds instead of 48 hours RUN echo "metadata_expire=60" >> /etc/dnf/dnf.conf && cat /etc/dnf/dnf.conf diff --git a/debian-repo-install-test/Dockerfile b/debian-repo-install-test/Dockerfile index e718a233..e12da756 100644 --- a/debian-repo-install-test/Dockerfile +++ b/debian-repo-install-test/Dockerfile @@ -1,6 +1,7 @@ ARG USER ARG REGISTRY=docker.io -FROM ${REGISTRY}/debian:stretch +ARG UPSTREAM_DISTRO=debian:stretch +FROM ${REGISTRY}/${UPSTREAM_DISTRO} COPY Release.key /tmp/Release.key diff --git a/debian-stretch-build/Dockerfile b/debian-stretch-build/Dockerfile index ac527087..96e92de3 100644 --- a/debian-stretch-build/Dockerfile +++ b/debian-stretch-build/Dockerfile @@ -1,5 +1,6 @@ ARG REGISTRY=docker.io -FROM ${REGISTRY}/debian:stretch +ARG UPSTREAM_DISTRO=debian:stretch +FROM ${REGISTRY}/${UPSTREAM_DISTRO} MAINTAINER Harald Welte diff --git a/debian-stretch-titan/Dockerfile b/debian-stretch-titan/Dockerfile index 74203483..01d941e8 100644 --- a/debian-stretch-titan/Dockerfile +++ b/debian-stretch-titan/Dockerfile @@ -1,5 +1,6 @@ ARG REGISTRY=docker.io -FROM ${REGISTRY}/debian:stretch +ARG UPSTREAM_DISTRO=debian:stretch +FROM ${REGISTRY}/${UPSTREAM_DISTRO} MAINTAINER Harald Welte diff --git a/jenkins-common.sh b/jenkins-common.sh index d9e79a48..fdcfd404 100644 --- a/jenkins-common.sh +++ b/jenkins-common.sh @@ -12,10 +12,18 @@ docker_depends() { docker_distro_from_image_name() { case "$1" in - osmo-*-centos8) echo "centos8"; ;; + osmo-*-centos8) echo "centos8" ;; + centos8-*) echo "centos8" ;; *) echo "debian-stretch" ;; esac +} +docker_upstream_distro_from_image_name() { + case "$1" in + osmo-*-centos8) echo "centos:centos8"; ;; + centos8-*) echo "centos:centos8" ;; + *) echo "debian:stretch" ;; + esac } docker_dir_from_image_name() { @@ -27,15 +35,20 @@ docker_dir_from_image_name() { # Make sure required images are available and build them if necessary. # $*: image names (e.g. "debian-stretch-build", "osmo-mgw-master", "osmo-mgw-master-centos8") -# The images are automatically built from the Dockerfile of the subdir of the same name. If there is a -# distribution name at the end of the image name (e.g. osmo-mgw-master-centos8), it gets removed from the subdir -# where the Dockerfile is taken from (e.g. osmo-mgw-master/Dockerfile) and DISTRO is passed accordingly -# (e.g. DISTRO=centos8). This allows one Dockerfile for multiple distributions, without duplicating configs for -# each distribution. Dependencies listed in docker_depends() are built automatically too. +# The images are automatically built from the Dockerfile of the subdir of +# the same name. If there is a distribution name at the end of the image +# name (e.g. osmo-mgw-master-centos8), it gets removed from the subdir +# where the Dockerfile is taken from (e.g. osmo-mgw-master/Dockerfile) +# and UPSTREAM_DISTRO and DISTRO are passed accordingly (e.g. +# UPSTREAM_DISTRO=centos:centos8 DISTRO=centos8). This allows one +# Dockerfile for multiple distributions, without duplicating configs for +# each distribution. Dependencies listed in docker_depends() are built +# automatically too. docker_images_require() { local i local from_line local pull_arg + local upstream_distro_arg local distro_arg local depends local dir @@ -49,6 +62,7 @@ docker_images_require() { # Trigger image build (cache will be used when up-to-date) if [ -z "$NO_DOCKER_IMAGE_BUILD" ]; then + upstream_distro_arg="$(docker_upstream_distro_from_image_name "$i")" distro_arg="$(docker_distro_from_image_name "$i")" dir="$(docker_dir_from_image_name "$i")" @@ -62,6 +76,7 @@ docker_images_require() { echo "Building image: $i (export NO_DOCKER_IMAGE_BUILD=1 to prevent this)" make -C "../$dir" \ PULL="$pull_arg" \ + UPSTREAM_DISTRO="$upstream_distro_arg" \ DISTRO="$distro_arg" \ IMAGE="$REPO_USER/$i" \ || exit 1 diff --git a/make/Makefile b/make/Makefile index 1a13c4d4..63562f3b 100644 --- a/make/Makefile +++ b/make/Makefile @@ -33,6 +33,7 @@ OSMO_SGSN_BRANCH?=master OSMO_SIP_BRANCH?=master OSMO_STP_BRANCH?=master PULL?= +UPSTREAM_DISTRO?=debian:stretch DISTRO?=debian-stretch RELEASE_SUPPORT := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST))))/.make-release-support @@ -61,6 +62,7 @@ docker-build: .release --build-arg USER=$(USERNAME) \ --build-arg REGISTRY=$(REGISTRY_HOST) \ --build-arg OSMO_TTCN3_BRANCH=$(OSMO_TTCN3_BRANCH) \ + --build-arg UPSTREAM_DISTRO=$(UPSTREAM_DISTRO) \ --build-arg DISTRO=$(DISTRO) \ --build-arg LIBOSMOCORE_BRANCH=$(LIBOSMOCORE_BRANCH) \ --build-arg OSMO_BB_BRANCH=$(OSMO_BB_BRANCH) \ diff --git a/osmo-bsc-latest/Dockerfile b/osmo-bsc-latest/Dockerfile index 1ab1e025..178af722 100644 --- a/osmo-bsc-latest/Dockerfile +++ b/osmo-bsc-latest/Dockerfile @@ -1,5 +1,6 @@ ARG REGISTRY=docker.io -FROM ${REGISTRY}/debian:stretch +ARG UPSTREAM_DISTRO=debian:stretch +FROM ${REGISTRY}/${UPSTREAM_DISTRO} MAINTAINER Harald Welte diff --git a/osmo-bts-latest/Dockerfile b/osmo-bts-latest/Dockerfile index df1d8328..954fc582 100644 --- a/osmo-bts-latest/Dockerfile +++ b/osmo-bts-latest/Dockerfile @@ -1,5 +1,6 @@ ARG REGISTRY=docker.io -FROM ${REGISTRY}/debian:stretch +ARG UPSTREAM_DISTRO=debian:stretch +FROM ${REGISTRY}/${UPSTREAM_DISTRO} MAINTAINER Harald Welte diff --git a/osmo-cn-latest/Dockerfile b/osmo-cn-latest/Dockerfile index ba986215..ca6859d4 100644 --- a/osmo-cn-latest/Dockerfile +++ b/osmo-cn-latest/Dockerfile @@ -1,5 +1,6 @@ ARG REGISTRY=docker.io -FROM ${REGISTRY}/debian:stretch +ARG UPSTREAM_DISTRO=debian:stretch +FROM ${REGISTRY}/${UPSTREAM_DISTRO} MAINTAINER Daniel Willmann diff --git a/osmo-ggsn-latest/Dockerfile b/osmo-ggsn-latest/Dockerfile index ac50c4ed..3430791a 100644 --- a/osmo-ggsn-latest/Dockerfile +++ b/osmo-ggsn-latest/Dockerfile @@ -1,5 +1,6 @@ ARG REGISTRY=docker.io -FROM ${REGISTRY}/debian:stretch +ARG UPSTREAM_DISTRO=debian:stretch +FROM ${REGISTRY}/${UPSTREAM_DISTRO} MAINTAINER Harald Welte diff --git a/osmo-hlr-latest/Dockerfile b/osmo-hlr-latest/Dockerfile index 606a2df2..a8e106c4 100644 --- a/osmo-hlr-latest/Dockerfile +++ b/osmo-hlr-latest/Dockerfile @@ -1,5 +1,6 @@ ARG REGISTRY=docker.io -FROM ${REGISTRY}/debian:stretch +ARG UPSTREAM_DISTRO=debian:stretch +FROM ${REGISTRY}/${UPSTREAM_DISTRO} MAINTAINER Harald Welte diff --git a/osmo-hnbgw-latest/Dockerfile b/osmo-hnbgw-latest/Dockerfile index 15e515f6..b39d2e77 100644 --- a/osmo-hnbgw-latest/Dockerfile +++ b/osmo-hnbgw-latest/Dockerfile @@ -1,5 +1,6 @@ ARG REGISTRY=docker.io -FROM ${REGISTRY}/debian:stretch +ARG UPSTREAM_DISTRO=debian:stretch +FROM ${REGISTRY}/${UPSTREAM_DISTRO} MAINTAINER Harald Welte diff --git a/osmo-mgw-latest/Dockerfile b/osmo-mgw-latest/Dockerfile index eba9ace8..27fb2596 100644 --- a/osmo-mgw-latest/Dockerfile +++ b/osmo-mgw-latest/Dockerfile @@ -1,5 +1,6 @@ ARG REGISTRY=docker.io -FROM ${REGISTRY}/debian:stretch +ARG UPSTREAM_DISTRO=debian:stretch +FROM ${REGISTRY}/${UPSTREAM_DISTRO} MAINTAINER Harald Welte diff --git a/osmo-msc-latest/Dockerfile b/osmo-msc-latest/Dockerfile index 6fc58589..e52a79ab 100644 --- a/osmo-msc-latest/Dockerfile +++ b/osmo-msc-latest/Dockerfile @@ -1,5 +1,6 @@ ARG REGISTRY=docker.io -FROM ${REGISTRY}/debian:stretch +ARG UPSTREAM_DISTRO=debian:stretch +FROM ${REGISTRY}/${UPSTREAM_DISTRO} MAINTAINER Harald Welte diff --git a/osmo-nitb-latest/Dockerfile b/osmo-nitb-latest/Dockerfile index 5dafc330..ccdb75ab 100644 --- a/osmo-nitb-latest/Dockerfile +++ b/osmo-nitb-latest/Dockerfile @@ -1,5 +1,6 @@ ARG REGISTRY=docker.io -FROM ${REGISTRY}/debian:stretch +ARG UPSTREAM_DISTRO=debian:stretch +FROM ${REGISTRY}/${UPSTREAM_DISTRO} MAINTAINER Harald Welte diff --git a/osmo-pcu-latest/Dockerfile b/osmo-pcu-latest/Dockerfile index ccd492c2..ad5187e9 100644 --- a/osmo-pcu-latest/Dockerfile +++ b/osmo-pcu-latest/Dockerfile @@ -1,5 +1,6 @@ ARG REGISTRY=docker.io -FROM ${REGISTRY}/debian:stretch +ARG UPSTREAM_DISTRO=debian:stretch +FROM ${REGISTRY}/${UPSTREAM_DISTRO} MAINTAINER Harald Welte diff --git a/osmo-remsim-latest/Dockerfile b/osmo-remsim-latest/Dockerfile index 22290322..fdc41ee2 100644 --- a/osmo-remsim-latest/Dockerfile +++ b/osmo-remsim-latest/Dockerfile @@ -1,5 +1,6 @@ ARG REGISTRY=docker.io -FROM ${REGISTRY}/debian:stretch +ARG UPSTREAM_DISTRO=debian:stretch +FROM ${REGISTRY}/${UPSTREAM_DISTRO} MAINTAINER Harald Welte diff --git a/osmo-sgsn-latest/Dockerfile b/osmo-sgsn-latest/Dockerfile index f24b11c6..23a06a13 100644 --- a/osmo-sgsn-latest/Dockerfile +++ b/osmo-sgsn-latest/Dockerfile @@ -1,5 +1,6 @@ ARG REGISTRY=docker.io -FROM ${REGISTRY}/debian:stretch +ARG UPSTREAM_DISTRO=debian:stretch +FROM ${REGISTRY}/${UPSTREAM_DISTRO} MAINTAINER Harald Welte diff --git a/osmo-sip-latest/Dockerfile b/osmo-sip-latest/Dockerfile index cdf1315c..a310ecde 100644 --- a/osmo-sip-latest/Dockerfile +++ b/osmo-sip-latest/Dockerfile @@ -1,5 +1,6 @@ ARG REGISTRY=docker.io -FROM ${REGISTRY}/debian:stretch +ARG UPSTREAM_DISTRO=debian:stretch +FROM ${REGISTRY}/${UPSTREAM_DISTRO} MAINTAINER Harald Welte diff --git a/osmo-stp-latest/Dockerfile b/osmo-stp-latest/Dockerfile index aca833fb..6651c449 100644 --- a/osmo-stp-latest/Dockerfile +++ b/osmo-stp-latest/Dockerfile @@ -1,5 +1,6 @@ ARG REGISTRY=docker.io -FROM ${REGISTRY}/debian:stretch +ARG UPSTREAM_DISTRO=debian:stretch +FROM ${REGISTRY}/${UPSTREAM_DISTRO} MAINTAINER Harald Welte