From f829a7a5bda51d00ebdd0484b939d881862138c7 Mon Sep 17 00:00:00 2001 From: Kevin Carter Date: Thu, 11 Jan 2024 11:26:41 -0600 Subject: [PATCH] switch horizon image to use horizon-rxt use multi-stage build Signed-off-by: Kevin Carter --- .github/workflows/release-horizon-rxt.yml | 3 +++ Containerfiles/HorizonRXT-Containerfile | 16 ++++++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release-horizon-rxt.yml b/.github/workflows/release-horizon-rxt.yml index e6b4563d..a41e4f5a 100644 --- a/.github/workflows/release-horizon-rxt.yml +++ b/.github/workflows/release-horizon-rxt.yml @@ -56,6 +56,8 @@ jobs: # This step uses the `docker/build-push-action` action to build the image, based on your repository's `Dockerfile`. If the build succeeds, it pushes the image to GitHub Packages. # It uses the `context` parameter to define the build's context as the set of files located in the specified path. For more information, see "[Usage](https://github.com/docker/build-push-action#usage)" in the README of the `docker/build-push-action` repository. # It uses the `tags` and `labels` parameters to tag and label the image with the output from the "meta" step. + - name: Dynamically set MY_DATE environment variable + run: echo "MY_DATE=$(date +%s)" >> $GITHUB_ENV - name: Build and push Docker image uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4 with: @@ -64,6 +66,7 @@ jobs: push: true tags: | ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/horizon-rxt:${{ github.event.inputs.pluginTag }} + ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/horizon-rxt:${{ github.event.inputs.pluginTag }}-${{ env.MY_DATE }} labels: ${{ steps.meta.outputs.labels }} build-args: | VERSION=${{ github.event.inputs.imageTag }} diff --git a/Containerfiles/HorizonRXT-Containerfile b/Containerfiles/HorizonRXT-Containerfile index 8f6f2028..3fc30a77 100644 --- a/Containerfiles/HorizonRXT-Containerfile +++ b/Containerfiles/HorizonRXT-Containerfile @@ -1,6 +1,14 @@ ARG VERSION=master-ubuntu_jammy -FROM openstackhelm/horizon:${VERSION} +FROM openstackhelm/horizon:${VERSION} as build ARG PLUGIN_VERSION=master -RUN /var/lib/openstack/bin/pip install --constraint=https://releases.openstack.org/constraints/upper/${PLUGIN_VERSION} \ - heat-dashboard \ - octavia-dashboard +RUN apt update && apt install -y git +RUN /var/lib/openstack/bin/pip install --upgrade --force-reinstall pip +RUN export ORIG_PLUGIN_VERSION="${PLUGIN_VERSION}"; \ + if [ "${PLUGIN_VERSION}" != 'master' ]; then export PLUGIN_VERSION=stable/${PLUGIN_VERSION}; fi; \ + . /var/lib/openstack/bin/activate; \ + /var/lib/openstack/bin/pip install --constraint=https://releases.openstack.org/constraints/upper/${ORIG_PLUGIN_VERSION} \ + git+https://opendev.org/openstack/heat-dashboard@${PLUGIN_VERSION}#egg=heat_dashboard \ + git+https://opendev.org/openstack/octavia-dashboard@${PLUGIN_VERSION}#egg=octavia_dashboard +RUN find /var/lib/openstack -regex '^.*\(__pycache__\|\.py[co]\)$' -delete +FROM openstackhelm/horizon:${VERSION} +COPY --from=build /var/lib/openstack/. /var/lib/openstack/