From 2864fb0f698af8985356d8ef91a7c04c9047183a Mon Sep 17 00:00:00 2001 From: Marlon Date: Tue, 26 Mar 2024 15:09:33 +0100 Subject: [PATCH 1/7] Update Dockerfile --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 17317b7..824f33f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,9 @@ # Based off of https://github.com/tembo-io/pgmq/blob/main/images/pgmq-pg/Dockerfile -ARG PG_MAJOR_VERSION=15 +ARG PG_MAJOR_VERSION=16 FROM postgres:${PG_MAJOR_VERSION}-bookworm as build -ARG PG_MAJOR_VERSION=15 +ARG PG_MAJOR_VERSION=16 RUN apt-get update && apt-get install -y --no-install-recommends \ build-essential \ From fbde12060364f004b827e8eb2dd6ec4187397708 Mon Sep 17 00:00:00 2001 From: Marlon Date: Tue, 26 Mar 2024 15:09:40 +0100 Subject: [PATCH 2/7] Create docker-publish.yml --- .github/workflows/docker-publish.yml | 97 ++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 .github/workflows/docker-publish.yml diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml new file mode 100644 index 0000000..63cff78 --- /dev/null +++ b/.github/workflows/docker-publish.yml @@ -0,0 +1,97 @@ +name: Docker + +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. + +on: + push: + branches: [ "main" ] + # Publish semver tags as releases. + tags: [ 'v*.*.*' ] + pull_request: + branches: [ "main" ] + workflow_dispatch: + +env: + # Use docker.io for Docker Hub if empty + REGISTRY: ghcr.io + # github.repository as / + IMAGE_NAME: ${{ github.repository }} + + +jobs: + build: + + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + # This is used to complete the identity challenge + # with sigstore/fulcio when running outside of PRs. + id-token: write + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + # Install the cosign tool except on PR + # https://github.com/sigstore/cosign-installer + - name: Install cosign + if: github.event_name != 'pull_request' + uses: sigstore/cosign-installer@6e04d228eb30da1757ee4e1dd75a0ec73a653e06 #v3.1.1 + with: + cosign-release: 'v2.1.1' + + # Set up BuildKit Docker container builder to be able to build + # multi-platform images and export cache + # https://github.com/docker/setup-buildx-action + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0 + + # 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@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + # Extract metadata (tags, labels) for Docker + # https://github.com/docker/metadata-action + - name: Extract Docker metadata + id: meta + uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0.0 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + + # 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 + id: build-and-push + uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0 + with: + context: . + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max + + # 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: + # https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable + TAGS: ${{ steps.meta.outputs.tags }} + DIGEST: ${{ steps.build-and-push.outputs.digest }} + # This step uses the identity token to provision an ephemeral certificate + # against the sigstore community Fulcio instance. + run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST} From f6e3f0d88f9de773cf47e91eed8cd91c1ce3d0b7 Mon Sep 17 00:00:00 2001 From: Marlon Date: Tue, 26 Mar 2024 15:15:38 +0100 Subject: [PATCH 3/7] Update Dockerfile --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 824f33f..90bd253 100644 --- a/Dockerfile +++ b/Dockerfile @@ -31,7 +31,7 @@ RUN $HOME/.cargo/bin/cargo pgrx install -c $(which pg_config) FROM postgres:${PG_MAJOR_VERSION}-bookworm -ARG PG_MAJOR_VERSION=15 +ARG PG_MAJOR_VERSION=16 COPY --from=build /usr/share/postgresql/${PG_MAJOR_VERSION}/extension /usr/share/postgresql/${PG_MAJOR_VERSION}/extension COPY --from=build /usr/lib/postgresql/${PG_MAJOR_VERSION}/lib /usr/lib/postgresql/${PG_MAJOR_VERSION}/lib From 3498fa85c435229164cc4b130ebfb81ae1de8e08 Mon Sep 17 00:00:00 2001 From: Marlon Date: Tue, 26 Mar 2024 16:00:29 +0100 Subject: [PATCH 4/7] Update docker-publish.yml --- .github/workflows/docker-publish.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 63cff78..8371ed0 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -40,7 +40,7 @@ jobs: # https://github.com/sigstore/cosign-installer - name: Install cosign if: github.event_name != 'pull_request' - uses: sigstore/cosign-installer@6e04d228eb30da1757ee4e1dd75a0ec73a653e06 #v3.1.1 + uses: sigstore/cosign-installer@e1523de7571e31dbe865fd2e80c5c7c23ae71eb4 #v3.4.0 with: cosign-release: 'v2.1.1' @@ -48,13 +48,13 @@ jobs: # multi-platform images and export cache # https://github.com/docker/setup-buildx-action - name: Set up Docker Buildx - uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0 + uses: docker/setup-buildx-action@2b51285047da1547ffb1b2203d8be4c0af6b1f20 # v3.2.0 # 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@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0 + uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20 # v3.1.0 with: registry: ${{ env.REGISTRY }} username: ${{ github.actor }} @@ -64,7 +64,7 @@ jobs: # https://github.com/docker/metadata-action - name: Extract Docker metadata id: meta - uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0.0 + uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5.5.1 with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} @@ -72,7 +72,7 @@ jobs: # https://github.com/docker/build-push-action - name: Build and push Docker image id: build-and-push - uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0 + uses: docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0 # v5.3.0 with: context: . push: ${{ github.event_name != 'pull_request' }} From ba29876de26ab5a8b32f0d3a86285b7e40c3b596 Mon Sep 17 00:00:00 2001 From: Marlon Date: Tue, 26 Mar 2024 16:09:20 +0100 Subject: [PATCH 5/7] Update docker-publish.yml --- .github/workflows/docker-publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 8371ed0..25a40a4 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -42,7 +42,7 @@ jobs: if: github.event_name != 'pull_request' uses: sigstore/cosign-installer@e1523de7571e31dbe865fd2e80c5c7c23ae71eb4 #v3.4.0 with: - cosign-release: 'v2.1.1' + cosign-release: 'v2.2.3' # Set up BuildKit Docker container builder to be able to build # multi-platform images and export cache From 3d60855c2ed86570e438c398203cfc0a8e6d90ee Mon Sep 17 00:00:00 2001 From: Marlon Date: Thu, 4 Apr 2024 19:17:24 +0000 Subject: [PATCH 6/7] Rename workflow to yaml and removed ci build for PRs --- .../workflows/{docker-publish.yml => docker-publish.yaml} | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) rename .github/workflows/{docker-publish.yml => docker-publish.yaml} (93%) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yaml similarity index 93% rename from .github/workflows/docker-publish.yml rename to .github/workflows/docker-publish.yaml index 25a40a4..6667eac 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yaml @@ -10,8 +10,6 @@ on: branches: [ "main" ] # Publish semver tags as releases. tags: [ 'v*.*.*' ] - pull_request: - branches: [ "main" ] workflow_dispatch: env: @@ -39,7 +37,6 @@ jobs: # Install the cosign tool except on PR # https://github.com/sigstore/cosign-installer - name: Install cosign - if: github.event_name != 'pull_request' uses: sigstore/cosign-installer@e1523de7571e31dbe865fd2e80c5c7c23ae71eb4 #v3.4.0 with: cosign-release: 'v2.2.3' @@ -53,7 +50,6 @@ jobs: # 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@e92390c5fb421da1463c202d546fed0ec5c39f20 # v3.1.0 with: registry: ${{ env.REGISTRY }} @@ -75,7 +71,7 @@ jobs: uses: docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0 # v5.3.0 with: context: . - push: ${{ github.event_name != 'pull_request' }} + push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} cache-from: type=gha @@ -87,7 +83,6 @@ jobs: # 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: # https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable TAGS: ${{ steps.meta.outputs.tags }} From 9bf7aa20f45d47f678318c266a6079d8399089ac Mon Sep 17 00:00:00 2001 From: Marlon Date: Fri, 26 Apr 2024 18:09:02 +0200 Subject: [PATCH 7/7] Added arm64 to build target --- .github/workflows/docker-publish.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/docker-publish.yaml b/.github/workflows/docker-publish.yaml index 6667eac..d3163fe 100644 --- a/.github/workflows/docker-publish.yaml +++ b/.github/workflows/docker-publish.yaml @@ -76,6 +76,7 @@ jobs: labels: ${{ steps.meta.outputs.labels }} cache-from: type=gha cache-to: type=gha,mode=max + platforms: linux/amd64,linux/arm64 # Sign the resulting Docker image digest except on PRs. # This will only write to the public Rekor transparency log when the Docker