diff --git a/.docker/release/Dockerfile b/.docker/release/Dockerfile index 31b431e34..b70d1757b 100644 --- a/.docker/release/Dockerfile +++ b/.docker/release/Dockerfile @@ -23,6 +23,9 @@ RUN set -eux; \ FROM php:8.1-fpm-alpine AS final LABEL org.label-schema.description="SnappyMail webmail client image using nginx, php-fpm on Alpine" +LABEL org.opencontainers.image.source=https://github.com/the-djmaze/snappymail +LABEL org.opencontainers.image.description="SnappyMail" +LABEL org.opencontainers.image.licenses="AGPL v3.0" # Install dependencies such as nginx RUN apk add --no-cache ca-certificates nginx supervisor bash diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index af675cd75..671515d51 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -1,13 +1,21 @@ name: docker + on: push: branches: - master tags: - '**' + # TODO: Remove this before merging PR pull_request: branches: - master + +# This is needed to push to GitHub Container Registry. See https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry +permissions: + contents: read + packages: write + jobs: build: runs-on: ubuntu-latest @@ -16,12 +24,14 @@ jobs: uses: actions/checkout@v3 # This step generates the docker tags + # TODO: Remove type=ref,event=pr before merging PR - name: Docker meta id: meta uses: docker/metadata-action@v4 with: images: | ${{ github.repository }} + ghcr.io/${{ github.repository }} # type=ref,event=pr generates tag(s) on PRs only. E.g. 'pr-123', 'pr-123-abc0123' # type=ref,event=branch generates tag(s) on branch only. E.g. 'master', 'master-abc0123' # type=ref,event=tag generates tag(s) on tags only. E.g. 'v0.0.0', 'v0.0.0-abc0123', and 'latest' @@ -55,6 +65,13 @@ jobs: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Login to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Build and push id: build-and-push uses: docker/build-push-action@v3