build and upload db imgae #56
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: docker build | |
| on: | |
| push: | |
| branches: | |
| - 'main' # Run only on pushes to the main branch | |
| tags: | |
| - '*.*.*' # Run on version tags like 1.2.3 | |
| pull_request: | |
| branches: | |
| - 'main' | |
| env: | |
| REGISTRY: ghcr.io | |
| jobs: | |
| build-and-push-image: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| attestations: write | |
| id-token: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Log in to the Container registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| # app image | |
| - name: Extract metadata (tags, labels) for Docker | |
| id: app_meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ${{ env.REGISTRY }}/eox-a/stac-fastapi-pgstac-pair-search/pair-search-app | |
| tags: | | |
| type=semver,pattern={{version}} | |
| type=raw,value=latest,enable={{is_default_branch}} | |
| type=ref,event=branch | |
| type=ref,event=pr | |
| - name: Build and push stac-fastapi-pgstac-pair-search image | |
| id: app_push | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| push: true | |
| tags: ${{ steps.app_meta.outputs.tags }} | |
| labels: ${{ steps.app_meta.outputs.labels }} | |
| - name: Generate artifact attestation | |
| uses: actions/attest-build-provenance@v2 | |
| with: | |
| subject-name: ${{ env.REGISTRY }}/eox-a/stac-fastapi-pgstac-pair-search/pair-search-app | |
| subject-digest: ${{ steps.app_push.outputs.digest }} | |
| push-to-registry: true | |
| # db image | |
| - name: Extract metadata (tags, labels) for Docker | |
| id: db_meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ${{ env.REGISTRY }}/eox-a/stac-fastapi-pgstac-pair-search/pgstac-pair-search | |
| tags: | | |
| type=semver,pattern={{version}} | |
| type=raw,value=latest,enable={{is_default_branch}} | |
| type=ref,event=branch | |
| type=ref,event=pr | |
| - name: Build and push pgstac-pair-search image | |
| id: db_push | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: ./pgstac-pair-search | |
| push: true | |
| tags: ${{ steps.db_meta.outputs.tags }} | |
| labels: ${{ steps.db_meta.outputs.labels }} | |
| - name: Generate artifact attestation | |
| uses: actions/attest-build-provenance@v2 | |
| with: | |
| subject-name: ${{ env.REGISTRY }}/eox-a/stac-fastapi-pgstac-pair-search/pgstac-pair-search | |
| subject-digest: ${{ steps.db_push.outputs.digest }} | |
| push-to-registry: true |