-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #60 from openmethane/container-version
Container version
- Loading branch information
Showing
6 changed files
with
51 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -56,13 +56,22 @@ jobs: | |
type=ref,event=branch | ||
type=ref,event=pr | ||
type=raw,value=build-${{ github.run_number }} | ||
# Duplicated from Dockerfile due to https://github.com/docker/metadata-action/issues/295 | ||
labels: | | ||
org.opencontainers.image.title="Open Methane Prior Emissions" | ||
org.opencontainers.image.description="Method to calculate a gridded, prior emissions estimate for methane across Australia." | ||
org.opencontainers.image.authors="Peter Rayner <[email protected]>, Jared Lewis <[email protected]>" | ||
org.opencontainers.image.vendor="The Superpower Institute" | ||
- name: Build and push image | ||
uses: docker/build-push-action@v5 | ||
id: build | ||
with: | ||
platforms: ${{ matrix.platform }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
tags: ${{ steps.meta.outputs.tags }} | ||
build-args: | | ||
OPENMETHANE_PRIOR_VERSION=${{ steps.meta.outputs.version }} | ||
push: true | ||
pull: false | ||
cache-from: type=gha | ||
|
@@ -86,6 +95,15 @@ jobs: | |
username: ${{ github.actor }} | ||
password: ${{ secrets.github_token }} | ||
steps: | ||
- name: Check package version | ||
if: startsWith(github.event.ref, 'refs/tags/v') | ||
run: | | ||
TAG_REF="${{ github.event.ref }}" | ||
TAG_VERSION=${TAG_REF/"refs\/tags\/"} | ||
if [ "$OPENMETHANE_PRIOR_VERSION" != "$TAG_VERSION" ]; then | ||
echo "OPENMETHANE_PRIOR_VERSION is $OPENMETHANE_PRIOR_VERSION; expected version is $TAG_VERSION" | ||
exit 1 | ||
fi | ||
- name: Run a quick test suite | ||
run: | | ||
cd /opt/project | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,7 +21,19 @@ RUN python -m venv /opt/venv && \ | |
# This isn't a hyper optimised container but it's a good starting point | ||
FROM python:3.11 | ||
|
||
LABEL org.opencontainers.image.authors="[email protected]" | ||
# These will be overwritten in GHA due to https://github.com/docker/metadata-action/issues/295 | ||
# These must be duplicated in .github/workflows/build_docker.yaml | ||
LABEL org.opencontainers.image.title="Open Methane Prior Emissions" | ||
LABEL org.opencontainers.image.description="Method to calculate a gridded, prior emissions estimate for methane across Australia." | ||
LABEL org.opencontainers.image.authors="Peter Rayner <[email protected]>, Jared Lewis <[email protected]>" | ||
LABEL org.opencontainers.image.vendor="The Superpower Institute" | ||
|
||
# OPENMETHANE_PRIOR_VERSION will be overridden in release builds with semver vX.Y.Z | ||
ARG OPENMETHANE_PRIOR_VERSION=development | ||
# Make the $OPENMETHANE_PRIOR_VERSION available as an env var inside the container | ||
ENV OPENMETHANE_PRIOR_VERSION=$OPENMETHANE_PRIOR_VERSION | ||
|
||
LABEL org.opencontainers.image.version="${OPENMETHANE_PRIOR_VERSION}" | ||
|
||
# Configure Python | ||
ENV PYTHONFAULTHANDLER=1 \ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Make OPENMETHANE_PRIOR_VERSION environment variable available inside the container |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters