pygeoapi: used fixed version of base image, edit init.sh as execution… #14
This file contains hidden or 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: Publish Pygeoapi Docker Image | |
| on: | |
| push: | |
| branches: [main] | |
| paths: | |
| - "pygeoapi/**" | |
| - "data/**" | |
| - ".github/workflows/pygeoapi-image.yml" | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| packages: write | |
| jobs: | |
| build-and-push: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Bump repo version | |
| run: | | |
| VERSION=$(cat pygeoapi/VERSION) | |
| IFS='.' read -r MAJ MIN PATCH <<<"$VERSION" | |
| PATCH=$((PATCH+1)) | |
| NEW_VERSION="$MAJ.$MIN.$PATCH" | |
| echo "$NEW_VERSION" > pygeoapi/VERSION | |
| echo "VERSION=$NEW_VERSION" >> "$GITHUB_ENV" | |
| - name: Commit version bump | |
| run: | | |
| git config user.name "GitHub Actions" | |
| git config user.email "[email protected]" | |
| git add pygeoapi/VERSION | |
| git commit -m "chore: bump repo version to $VERSION" && git push || echo "No changes to commit" | |
| - name: Get pygeoapi version | |
| id: pgv | |
| run: | | |
| PYGEOAPI_VERSION=$(docker run --rm geopython/pygeoapi:latest pygeoapi --version 2>&1 | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' || echo "0.14.0") | |
| echo "PYGEOAPI_VERSION=$PYGEOAPI_VERSION" >> $GITHUB_OUTPUT | |
| - name: Log in to GHCR | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build and push Docker image | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| file: ./pygeoapi/docker/Dockerfile.pygeoapi | |
| push: true | |
| build-args: | | |
| REPO_VERSION=${{ env.VERSION }} | |
| tags: | | |
| ghcr.io/${{ github.repository_owner }}/pygeoapi-w-global-tsunami-data:latest | |
| ghcr.io/${{ github.repository_owner }}/pygeoapi-w-global-tsunami-data:${{ steps.pgv.outputs.PYGEOAPI_VERSION }}-${{ env.VERSION }} |