Using the callable parameters specified in the error message. #34
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
name: Build containers | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- 'main' | |
paths: | |
- 'docker/*' | |
- '*.py' | |
- '*.ipynb' | |
- '.github/workflows/build-docker.yml' | |
concurrency: | |
# make sure only one run of this workflow for a given PR or a given branch | |
# can happen at one time. previous queued or started runs will be cancelled. | |
# github.workflow is the workflow name | |
# github.ref is the ref that triggered the workflow run | |
# on push, this is refs/heads/<branch name> | |
# on pull request, this is refs/pull/<pull request number>/merge | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
defaults: | |
run: | |
shell: bash -l {0} | |
env: | |
CONTAINER_NAME: prototype-jupyter-layer-clipping-app | |
jobs: | |
build: | |
name: Build containers | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
steps: | |
- uses: actions/checkout@v3 | |
- name: login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Determine version | |
run: echo "DATESTAMP_VERSION=$(date +%F)" >> $GITHUB_ENV | |
- name: Build docker | |
run: | | |
cd docker && docker build \ | |
-t ghcr.io/${{ github.repository_owner }}/${{ env.CONTAINER_NAME }}:latest \ | |
-t ghcr.io/${{ github.repository_owner }}/${{ env.CONTAINER_NAME }}:${{ env.DATESTAMP_VERSION }} \ | |
-t ghcr.io/${{ github.repository_owner }}/${{ env.CONTAINER_NAME }}:$(git rev-parse --short HEAD) \ | |
. | |
- name: Test that GDAL and pygeoprocessing import | |
run: | | |
docker run --rm ghcr.io/${{ github.repository_owner }}/${{ env.CONTAINER_NAME }}:latest python -c "from osgeo import gdal" | |
docker run --rm ghcr.io/${{ github.repository_owner }}/${{ env.CONTAINER_NAME }}:latest python -c "import pygeoprocessing" | |
- name: Push docker | |
run: | | |
docker image push --all-tags ghcr.io/${{ github.repository_owner }}/${{ env.CONTAINER_NAME }} |