Skip to content

fix hug.docker upload #46

fix hug.docker upload

fix hug.docker upload #46

Workflow file for this run

name: Docker Build and Push
on:
push:
tags:
- "v*.*"
- "v*.*.*"
workflow_dispatch:
env:
IMAGE_NAME: docker2compose
DOCKERFILE: ./Dockerfile
PLATFORMS: linux/amd64,linux/arm64,linux/arm/v7
DEFAULT_BRANCH: master
jobs:
build:
name: Build and Push
runs-on: ubuntu-latest
steps:
- name: Checkout
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
# 只登录 Docker Hub(跳过 GHCR)
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
# 提取镜像元数据
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: coracoo/${{ env.IMAGE_NAME }}
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=ref,event=tag
type=sha
type=raw,value=latest,enable={{is_default_branch}}
# 构建和推送
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
file: ${{ env.DOCKERFILE }}
platforms: ${{ env.PLATFORMS }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
no-cache: true
build-args: |
BUILD_DATE=${{ github.event.head_commit.timestamp }}
VCS_REF=${{ github.sha }}
VERSION=${{ github.ref_name }}