mirror of
https://github.com/yanhao98/composite-actions.git
synced 2025-07-13 23:00:48 +08:00
测试 docker-build-push
This commit is contained in:
37
docker-build-push/action.yml
Normal file
37
docker-build-push/action.yml
Normal 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
|
Reference in New Issue
Block a user