Skip to content

fix: 移除不存在的 python3.12-distutils 包 #23

fix: 移除不存在的 python3.12-distutils 包

fix: 移除不存在的 python3.12-distutils 包 #23

name: Build and Push Docker Images
on:
push:
tags:
- 'v*'
workflow_dispatch:
inputs:
push_to_registry:
description: 'Push to Docker registry'
required: true
default: 'true'
type: choice
options:
- 'true'
- 'false'
env:
# Docker Hub 用户名(硬编码)
DOCKERHUB_USERNAME: hgmzhn
# 镜像名称
IMAGE_NAME: manga-translator
jobs:
build-and-push:
runs-on: ubuntu-latest
timeout-minutes: 120
strategy:
matrix:
build_type: [cpu, gpu]
steps:
- name: Checkout repository
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: Log in to Docker Hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
username: hgmzhn
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch,suffix=-${{ matrix.build_type }}
type=ref,event=pr,suffix=-${{ matrix.build_type }}
type=semver,pattern={{version}},suffix=-${{ matrix.build_type }}
type=semver,pattern={{major}}.{{minor}},suffix=-${{ matrix.build_type }}
type=raw,value=latest-${{ matrix.build_type }},enable={{is_default_branch}}
flavor: |
latest=false
- name: Build and push Docker image
id: build
uses: docker/build-push-action@v5
with:
context: .
file: ./packaging/Dockerfile
push: ${{ github.event_name != 'pull_request' && (github.event.inputs.push_to_registry != 'false') }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
BUILD_TYPE=${{ matrix.build_type }}
CUDA_VERSION=12.1.0
PYTHON_VERSION=3.12
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: linux/amd64
- name: Image digest
run: echo ${{ steps.build.outputs.digest }}