diff --git a/.github/workflows/publish_docker_base.yml b/.github/workflows/publish_docker_base.yml new file mode 100644 index 000000000..1aaf45568 --- /dev/null +++ b/.github/workflows/publish_docker_base.yml @@ -0,0 +1,31 @@ +name: Publish Base Docker Image to GHCR + +on: + push: + branches: + - main + paths: + - 'openshift/wps-api-base/docker/Dockerfile' + - '.github/workflows/publish_docker_base.yml' +jobs: + build-and-publish: + name: Build and Publish Docker Image + runs-on: ubuntu-24.04 + steps: + - name: Checkout repo + uses: actions/checkout@v4 + - name: Login to GitHub Container Registry + # this step requires a GH_TOKEN with read:packages write:packages and delete:packages + # tested with a classic token with the above permissions + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{github.actor}} + password: ${{secrets.GITHUB_TOKEN}} + - name: Build and Publish Base Image + run: | + cd openshift/wps-api-base/docker + docker build . --tag ghcr.io/bcgov/wps/wps-api-base:$(date +%m-%d-%Y) + docker tag ghcr.io/bcgov/wps/wps-api-base:$(date +%m-%d-%Y) ghcr.io/bcgov/wps/wps-api-base:latest + docker push ghcr.io/bcgov/wps/wps-api-base:$(date +%m-%d-%Y) + docker push ghcr.io/bcgov/wps/wps-api-base:latest diff --git a/openshift/wps-api-base/docker/Dockerfile b/openshift/wps-api-base/docker/Dockerfile index 8b170ac89..67e2b103c 100644 --- a/openshift/wps-api-base/docker/Dockerfile +++ b/openshift/wps-api-base/docker/Dockerfile @@ -1,14 +1,6 @@ -ARG DOCKER_IMAGE=artifacts.developer.gov.bc.ca/github-docker-remote/osgeo/gdal:ubuntu-small-3.9.2 -# For the final stage, we use ubuntu:24.04 -# Rationale for using ubuntu:24.04: -# - It's the latest ubuntu LTS release. -# - It generally has a more recent version of gdal than debian. -# - It generally has a fairly recent version of python. -# - It has a more recent version of wkhtmltopdf and supporting libraries than debian. -# -# When building local, you can pull direct from docker, instead of artifacts.developer.gov.bc.ca: -# docker build --build-arg DOCKER_IMAGE=ubuntu:24.04 . --tag=wps-api-base:ubuntu.24.04-latest -FROM ${DOCKER_IMAGE} +FROM ghcr.io/osgeo/gdal:ubuntu-small-3.9.2 +# in order to make the image public on GHCR, we need to add this label +LABEL org.opencontainers.image.source="https://github.com/bcgov/wps" # We don't want to run our app as root, so we define a worker user. ARG USERNAME=worker diff --git a/openshift/wps-api-base/openshift/build.yaml b/openshift/wps-api-base/openshift/build.yaml index 09e60d5d2..e5df977df 100644 --- a/openshift/wps-api-base/openshift/build.yaml +++ b/openshift/wps-api-base/openshift/build.yaml @@ -57,17 +57,9 @@ objects: name: ${NAME}${SUFFIX}:${VERSION} source: dockerfile: | - ARG DOCKER_IMAGE=artifacts.developer.gov.bc.ca/github-docker-remote/osgeo/gdal:ubuntu-small-3.9.2 - # For the final stage, we use ubuntu:24.04 - # Rationale for using ubuntu:24.04: - # - It's the latest ubuntu LTS release. - # - It generally has a more recent version of gdal than debian. - # - It generally has a fairly recent version of python. - # - It has a more recent version of wkhtmltopdf and supporting libraries than debian. - # - # When building local, you can pull direct from docker, instead of artifacts.developer.gov.bc.ca: - # docker build --build-arg DOCKER_IMAGE=ubuntu:24.04 . --tag=wps-api-base:ubuntu.24.04-latest - FROM ${DOCKER_IMAGE} + FROM ghcr.io/osgeo/gdal:ubuntu-small-3.9.2 + # in order to make the image public on GHCR, we need to add this label + LABEL org.opencontainers.image.source="https://github.com/bcgov/wps" # We don't want to run our app as root, so we define a worker user. ARG USERNAME=worker