Skip to content

Publish Docker image #7

Publish Docker image

Publish Docker image #7

name: Publish Docker image
on:
release:
types: [published]
workflow_dispatch:
inputs:
logLevel:
description: 'Log level (e.g., debug, info, warning, error)'
required: false
default: 'info'
type: choice
options:
- debug
- info
- warning
- error
jobs:
push_to_registry:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
steps:
- name: Delete tools cache
run: rm -rf /opt/hostedtoolcache
- name: Check out the repo
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Log in to Docker Hub
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: ericup/celldetection
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
file: ./docker/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}