测试 docker-build-push

This commit is contained in:
严浩
2024-10-08 22:09:53 +08:00
committed by GitHub
parent 121eca08de
commit f18151bb95
2 changed files with 46 additions and 6 deletions

View File

@ -0,0 +1,37 @@
name: "打包推送 Docker 镜像"
description: "打包 Docker 镜像并推送到 Docker Hub"
inputs:
dockerhub_username:
description: "Docker Hub 用户名"
required: true
dockerhub_token:
description: "Docker Hub Token"
required: true
runs:
using: "composite"
steps:
- uses: actions/checkout@main
with:
filter: blob:none
show-progress: false
- name: Login to DockerHub
uses: docker/login-action@v3
with:
registry: docker.io
username: ${{ inputs.dockerhub_username }}
password: ${{ inputs.dockerhub_token }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
file: ./Dockerfile
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache