Push to ghcr.io

This commit is contained in:
Leonard Jonathan Oh 2023-03-13 15:59:26 +00:00
parent f1d1c175f9
commit 7ac893b179
2 changed files with 20 additions and 0 deletions

View file

@ -23,6 +23,9 @@ RUN set -eux; \
FROM php:8.1-fpm-alpine AS final 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.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 # Install dependencies such as nginx
RUN apk add --no-cache ca-certificates nginx supervisor bash RUN apk add --no-cache ca-certificates nginx supervisor bash

View file

@ -1,13 +1,21 @@
name: docker name: docker
on: on:
push: push:
branches: branches:
- master - master
tags: tags:
- '**' - '**'
# TODO: Remove this before merging PR
pull_request: pull_request:
branches: branches:
- master - 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: jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -16,12 +24,14 @@ jobs:
uses: actions/checkout@v3 uses: actions/checkout@v3
# This step generates the docker tags # This step generates the docker tags
# TODO: Remove type=ref,event=pr before merging PR
- name: Docker meta - name: Docker meta
id: meta id: meta
uses: docker/metadata-action@v4 uses: docker/metadata-action@v4
with: with:
images: | images: |
${{ github.repository }} ${{ 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=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=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' # 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 }} username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }} 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 - name: Build and push
id: build-and-push id: build-and-push
uses: docker/build-push-action@v3 uses: docker/build-push-action@v3