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
This commit is contained in:
Michael Beaver 2020-03-19 17:38:59 -05:00
parent a30882a38b
commit be9c3b6c13
3 changed files with 12 additions and 4 deletions

View File

@ -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

View File

@ -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

View File

@ -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}" \