-
Notifications
You must be signed in to change notification settings - Fork 0
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 #1 from SectorLabs/187045425-create-public-postgis…
…-image Create public postgis image [#187045425]
- Loading branch information
Showing
4 changed files
with
81 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,77 @@ | ||
name: Docker PostGIS CI | ||
|
||
on: | ||
push: | ||
branches: [ "master" ] | ||
pull_request: | ||
branches: [ "master" ] | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
jobs: | ||
|
||
make-docker-images: | ||
strategy: | ||
matrix: | ||
postgres: [13, 14] | ||
postgis: ['3.4'] | ||
variant: [alpine] | ||
|
||
name: Build docker image for ${{ matrix.postgres }}-${{ matrix.postgis }} variant ${{ matrix.variant }} | ||
runs-on: ubuntu-20.04 | ||
continue-on-error: false | ||
env: | ||
VERSION: ${{ matrix.postgres }}-${{ matrix.postgis }} | ||
VARIANT: ${{ matrix.variant }} | ||
REGISTRY: ghcr.io | ||
# tag as <account>/<repo>:13-13.4-alpine-854f69c8ae1f41bfc6f14435575efbccaa5e9e5d | ||
IMAGE_TAG: ${{ format('{0}:{1}-{2}-{3}-{4}', github.repository, matrix.postgres, matrix.postgis, matrix.variant, github.sha) }} | ||
DOCKERFILE_LOCATION: ./${{ format('{0}-{1}', matrix.postgres, matrix.postgis)}}/${{ matrix.variant }} | ||
|
||
steps: | ||
- name: Checkout source | ||
uses: actions/checkout@v4 | ||
|
||
# Login against a Docker registry except on PR | ||
# https://github.com/docker/login-action | ||
- name: Log into registry ${{ env.REGISTRY }} | ||
if: github.event_name != 'pull_request' | ||
uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Convert $IMAGE_TAG to lowercase | ||
id: tag-to-lowercase | ||
run: | | ||
echo Converting ${{ env.IMAGE_TAG }} to lowercase... | ||
IMAGE_TAG_LOWERCASE=$(echo "${{ env.IMAGE_TAG }}" | tr '[:upper:]' '[:lower:]') | ||
echo "IMAGE_TAG in lowercase is $IMAGE_TAG_LOWERCASE" | ||
echo "IMAGE_TAG_LOWERCASE=$IMAGE_TAG_LOWERCASE" >> $GITHUB_ENV | ||
# Build and push Docker image with Buildx (don't push on PR) | ||
# https://github.com/docker/build-push-action | ||
- name: Build and push Docker image for ${{ env.VERSION }} ${{ env.VARIANT }} | ||
id: build-and-push | ||
uses: docker/build-push-action@ac9327eae2b366085ac7f6a2d02df8aa8ead720a | ||
with: | ||
context: ${{ env.DOCKERFILE_LOCATION }} | ||
file: ${{ env.DOCKERFILE_LOCATION }}/Dockerfile | ||
push: ${{ github.event_name != 'pull_request' }} | ||
tags: ${{ steps.tag-to-lowercase.outputs.IMAGE_TAG_LOWERCASE }} | ||
|
||
# Sign the resulting Docker image digest except on PRs. | ||
# This will only write to the public Rekor transparency log when the Docker | ||
# repository is public to avoid leaking data. If you would like to publish | ||
# transparency data even for private images, pass --force to cosign below. | ||
# https://github.com/sigstore/cosign | ||
- name: Sign the published Docker image | ||
if: ${{ github.event_name != 'pull_request' }} | ||
env: | ||
COSIGN_EXPERIMENTAL: "true" | ||
# This step uses the identity token to provision an ephemeral certificate | ||
# against the sigstore community Fulcio instance. | ||
run: echo "${{ steps.tag-to-lowercase.outputs.IMAGE_TAG_LOWERCASE }}" | xargs -I {} cosign sign {}@${{ steps.build-and-push.outputs.digest }} |
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,2 @@ | ||
_* | ||
**/node_modules/ |
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 @@ | ||
FROM docker.io/postgis/postgis:13-3.4-alpine |
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 @@ | ||
FROM docker.io/postgis/postgis:14-3.4-alpine |