From be9c3b6c13e1d7267c3a9bf8138e660580475dfa Mon Sep 17 00:00:00 2001 From: Michael Beaver Date: Thu, 19 Mar 2020 17:38:59 -0500 Subject: [PATCH] Add base image overrides to mini-mirror image This adds environment variables for the build script that can be set to individually override the base ubuntu build image for mini-mirror as well as the final nginx image. This does not change the deafult functionality and allows the mini-mirror build to be more configurable if the end user wishes to substitute in their own images Change-Id: I49e0415354ce8953b759de92367849b8f9ece50b --- mini-mirror/Dockerfile.ubuntu_bionic | 6 ++++-- mini-mirror/Dockerfile.ubuntu_xenial | 6 ++++-- mini-mirror/build.sh | 4 ++++ 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/mini-mirror/Dockerfile.ubuntu_bionic b/mini-mirror/Dockerfile.ubuntu_bionic index 66a22782..d8d7beb4 100644 --- a/mini-mirror/Dockerfile.ubuntu_bionic +++ b/mini-mirror/Dockerfile.ubuntu_bionic @@ -12,7 +12,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -FROM ubuntu:18.04 as aptly +ARG FROM_UBUNTU=ubuntu:18.04 +ARG FROM_NGINX=nginx +FROM ${FROM_UBUNTU} as aptly ARG APTLY_CONFIG_PATH=etc/aptly.conf ARG MIRROR_SOURCE_FILE=mini-mirror-sources.yaml @@ -38,7 +40,7 @@ COPY tools/publish_snapshots.sh /opt/publish_snapshots.sh RUN /opt/publish_snapshots.sh "${RELEASE_SIGN_KEY_PASSPHRASE}" -FROM nginx +FROM ${FROM_NGINX} ARG APTLY_SNAPSHOT_DIR=/srv diff --git a/mini-mirror/Dockerfile.ubuntu_xenial b/mini-mirror/Dockerfile.ubuntu_xenial index ffc6e131..c31f256f 100644 --- a/mini-mirror/Dockerfile.ubuntu_xenial +++ b/mini-mirror/Dockerfile.ubuntu_xenial @@ -12,7 +12,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -FROM ubuntu:16.04 as aptly +ARG FROM_UBUNTU=ubuntu:16.04 +ARG FROM_NGINX=nginx +FROM ${FROM_UBUNTU} as aptly ARG APTLY_CONFIG_PATH=etc/aptly.conf ARG MIRROR_SOURCE_FILE=mini-mirror-sources.yaml @@ -38,7 +40,7 @@ COPY tools/publish_snapshots.sh /opt/publish_snapshots.sh RUN /opt/publish_snapshots.sh "${RELEASE_SIGN_KEY_PASSPHRASE}" -FROM nginx +FROM ${FROM_NGINX} ARG APTLY_SNAPSHOT_DIR=/srv diff --git a/mini-mirror/build.sh b/mini-mirror/build.sh index 66ccd495..99e59a8a 100755 --- a/mini-mirror/build.sh +++ b/mini-mirror/build.sh @@ -22,6 +22,8 @@ cd "${SCRIPT_DIR}"/.. || exit PROJECT_PATH="mini-mirror" IMAGE=${IMAGE:-mini-mirror} +BASE_IMAGE_UBUNTU=${BASE_IMAGE_UBUNTU:-} +BASE_IMAGE_NGINX=${BASE_IMAGE_NGINX:-} VERSION=${VERSION:-latest} DISTRO=${DISTRO:-ubuntu_xenial} REGISTRY_URI=${REGISTRY_URI:-"openstackhelm/"} @@ -45,6 +47,8 @@ APTLY_REFSPEC=${APTLY_REFSPEC:-"allow-custom-codename"} docker build -f "${PROJECT_PATH}"/Dockerfile."${DISTRO}" --network=host \ -t "${REGISTRY_URI}""${IMAGE}":"${VERSION}"-"${DISTRO}""${EXTRA_TAG_INFO}" \ + ${BASE_IMAGE_UBUNTU:+--build-arg FROM_UBUNTU=${BASE_IMAGE_UBUNTU}} \ + ${BASE_IMAGE_NGINX:+--build-arg FROM_NGINX=${BASE_IMAGE_NGINX}} \ --build-arg http_proxy="${HTTP_PROXY}" \ --build-arg https_proxy="${HTTPS_PROXY}" \ --build-arg HTTP_PROXY="${HTTP_PROXY}" \