Skip to content

Publish Docker image #1470

Publish Docker image

Publish Docker image #1470

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