Skip to content

Publish Docker image #1322

Publish Docker image

Publish Docker image #1322

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@v4
- name: Log in to Docker Hub
uses: docker/login-action@29df2a9f8c71c2dfe7db598180a0460355ec1c00
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Log in to the Container registry
uses: docker/login-action@29df2a9f8c71c2dfe7db598180a0460355ec1c00
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@70b2cdc6480c1a8b86edf1777157f8f437de2166
with:
images: |
djdembeck/bragibooks
ghcr.io/${{ github.repository }}
- name: Build and push Docker images
uses: docker/build-push-action@4f58ea79222b3b9dc2c8bbdd6debcef730109a75
with:
file: docker/Dockerfile
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}