Skip to content

Commit

Permalink
Add GitHub action to publish Docker image
Browse files Browse the repository at this point in the history
  • Loading branch information
codedmonkey committed May 27, 2024
1 parent 1f2fd59 commit f9477e4
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 0 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Publish Docker image

on: push

jobs:
publish-images:
name: Publish Docker Images
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
attestations: write
steps:
-
name: Check out repo
uses: actions/checkout@v4

-
name: Extract metadata for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ghcr.io/${{ github.repository }}

-
name: Login to GitHub Packages
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

-
name: Build and push Docker image
id: push
uses: docker/build-push-action@v4
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

-
name: Generate artifact attestation
uses: actions/attest-build-provenance@v1
with:
subject-name: ghcr.io/${{ github.repository }}
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: true
4 changes: 4 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ RUN set -eux; \

FROM alpine:3.19

LABEL org.opencontainers.image.source=https://github.com/codedmonkey/conductor
LABEL org.opencontainers.image.description="Conductor PHP Package Registry"
LABEL org.opencontainers.image.licenses=MIT

ARG UID=1000
ARG GID=1000

Expand Down

0 comments on commit f9477e4

Please sign in to comment.