Skip to content

Commit

Permalink
ci: 添加 Docker 镜像构建和发布工作流
Browse files Browse the repository at this point in the history
  • Loading branch information
junlongzzz committed Nov 8, 2024
1 parent 3e60ee2 commit 5f3d82b
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Build and publish docker image

on:
workflow_dispatch:
push:
tags:
- 'v*.*.*'

jobs:
build-image:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
# 使用 owner/repo 作为镜像名称
images: ${{ github.repository }}
tags: |
type=semver,pattern={{version}}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ github.repository_owner }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
platforms: linux/amd64, linux/arm64
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ FROM alpine:latest

LABEL maintainer="Junlong Zhang <[email protected]>"

ENV TZ=Asia/Shanghai

WORKDIR /app

COPY --from=builder /app/fda .
Expand Down

0 comments on commit 5f3d82b

Please sign in to comment.