mirror of
https://github.com/SunBK201/UA3F.git
synced 2025-12-16 08:44:29 +00:00
feat: add GitHub Actions workflow for building and pushing Docker images
This commit is contained in:
parent
99d5b688f8
commit
fa5dfd7dda
47
.github/workflows/release.yaml
vendored
Normal file
47
.github/workflows/release.yaml
vendored
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
name: Build and Push Docker Image
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- 'v*'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Check out repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v3
|
||||||
|
with:
|
||||||
|
platforms: all
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- name: Log in to Docker Hub
|
||||||
|
uses: docker/login-action@v2
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Build and push Docker images
|
||||||
|
uses: docker/build-push-action@v4
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
push: true
|
||||||
|
platforms: |
|
||||||
|
linux/amd64,
|
||||||
|
linux/arm/v7,
|
||||||
|
linux/arm64,
|
||||||
|
linux/386,
|
||||||
|
linux/mips64le,
|
||||||
|
linux/mipsle,
|
||||||
|
linux/riscv64,
|
||||||
|
windows/amd64,
|
||||||
|
windows/arm64,
|
||||||
|
darwin/amd64,
|
||||||
|
darwin/arm64
|
||||||
|
tags: sunbk201/ua3f:${{ github.ref }}
|
||||||
22
Dockerfile
Normal file
22
Dockerfile
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
FROM --platform=$BUILDPLATFORM golang:1.19-alpine AS builder
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY src/go.mod src/go.sum ./
|
||||||
|
|
||||||
|
COPY src/ ./
|
||||||
|
|
||||||
|
ARG TARGETOS
|
||||||
|
ARG TARGETARCH
|
||||||
|
|
||||||
|
RUN CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH go build -trimpath -ldflags="-s -w" -o ua3f
|
||||||
|
|
||||||
|
FROM alpine
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY --from=builder /app/ua3f .
|
||||||
|
|
||||||
|
EXPOSE 1080
|
||||||
|
|
||||||
|
ENTRYPOINT ["/app/ua3f"]
|
||||||
Loading…
Reference in New Issue
Block a user