Skip to content

Publish Docker image #699

Publish Docker image

Publish Docker image #699

name: Publish Docker image
on:
workflow_dispatch:
push:
branches:
- main
- develop
# Publish semver tags as releases.
tags: ['v*.*.*']
jobs:
push_to_registries:
name: Push Docker image to multiple registries
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- name: Check out the repo
uses: actions/checkout@v3
- name: Log in to Docker Hub
uses: docker/login-action@a9794064588be971151ec5e7144cb535bcb56e36
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Log in to the Container registry
uses: docker/login-action@a9794064588be971151ec5e7144cb535bcb56e36
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@35e9aff4f5d665b5aa8a8f2adffaf8a1b5f49cc0
with:
images: |
djdembeck/bragibooks
ghcr.io/${{ github.repository }}
- name: Build and push Docker images
uses: docker/build-push-action@4b0752a2b1b87033d946e4e0106643f20d69d613
with:
file: docker/Dockerfile
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}