docker 自动构建脚本

This commit is contained in:
ztx
2025-01-06 14:15:13 +08:00
parent 9f63e61d31
commit fc43e13107

38
.github/workflows/docker-build.yml vendored Normal file
View File

@@ -0,0 +1,38 @@
name: Docker Build and Push
on:
workflow_dispatch: # 允许手动触发
inputs:
tag:
description: 'Docker image tag'
required: true
default: 'latest'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
push: true
platforms: linux/amd64
tags: |
fightroad/dicomscp:${{ github.event.inputs.tag }}
fightroad/dicomscp:latest
cache-from: type=registry,ref=fightroad/dicomscp:buildcache
cache-to: type=registry,ref=fightroad/dicomscp:buildcache,mode=max