Skip to content

Commit

Permalink
Publish base container to ghcr (#4032)
Browse files Browse the repository at this point in the history
Co-authored-by: Conor Brady <[email protected]>
  • Loading branch information
compscidr and conbrad authored Oct 21, 2024
1 parent c7060a0 commit 9466769
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 22 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/publish_docker_base.yml
Original file line number Diff line number Diff line change
@@ -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
14 changes: 3 additions & 11 deletions openshift/wps-api-base/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand Down
14 changes: 3 additions & 11 deletions openshift/wps-api-base/openshift/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9466769

Please sign in to comment.