Skip to content

Publish Docker image #2

Publish Docker image

Publish Docker image #2

name: Publish Docker image
on:
workflow_dispatch:
release:
types: [published]
jobs:
publish:
runs-on: ubuntu-latest
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
REPO_NAME: ${{ github.event.repository.name }}
environment:
name: Docker Registry
url: https://hub.docker.com/r/$DOCKERHUB_USERNAME/$REPO_NAME
steps:
- uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: $DOCKERHUB_USERNAME
password: $DOCKERHUB_TOKEN
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
tags: $DOCKERHUB_USERNAME/$REPO_NAME:latest
push: true