1
0
mirror of https://github.com/nitezs/sub2clash.git synced 2024-12-23 22:04:41 -05:00
This commit is contained in:
Nite07 2024-04-18 00:15:45 +08:00
parent 4384e56cc6
commit faaf5c366a
4 changed files with 5 additions and 21 deletions

View File

@ -15,7 +15,6 @@ builds:
- -s -w -X sub2clash/config.Version={{ .Version }} - -s -w -X sub2clash/config.Version={{ .Version }}
flags: flags:
- -trimpath - -trimpath
no_unique_dist_dir: true
archives: archives:
- format: tar.gz - format: tar.gz
format_overrides: format_overrides:

View File

@ -6,7 +6,7 @@ steps:
- name: build - name: build
image: woodpeckerci/plugin-docker-buildx image: woodpeckerci/plugin-docker-buildx
settings: settings:
platforms: linux/amd64 platforms: linux/amd64,linux/arm64,linux/arm/v7
repo: nite07/sub2clash repo: nite07/sub2clash
tag: nightly tag: nightly
username: nite07 username: nite07

View File

@ -5,9 +5,9 @@ steps:
- name: build - name: build
image: woodpeckerci/plugin-docker-buildx image: woodpeckerci/plugin-docker-buildx
settings: settings:
platforms: linux/amd64 platforms: linux/amd64,linux/arm64,linux/arm/v7
repo: nite07/sub2clash repo: nite07/sub2clash
tag: ${CI_COMMIT_TAG} auto_tag: true
username: nite07 username: nite07
password: password:
from_secret: docker_password from_secret: docker_password

View File

@ -1,27 +1,12 @@
# 使用官方 Golang 镜像作为构建环境
FROM golang:1.21-alpine as builder FROM golang:1.21-alpine as builder
LABEL authors="nite07" LABEL authors="nite07"
# 设置工作目录
WORKDIR /app WORKDIR /app
# 复制源代码到工作目录
COPY . . COPY . .
RUN go mod download RUN go mod download
# 获取参数
ARG version ARG version
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w -X sub2clash/config.Version=${version}" -o sub2clash .
# 使用 -ldflags 参数进行编译
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w -X sub2clash/config.Version=${version}" -o sub2clash main.go
FROM alpine:latest FROM alpine:latest
# 设置工作目录
WORKDIR /app WORKDIR /app
# 从 builder 镜像中复制出编译好的二进制文件
COPY --from=builder /app/sub2clash /app/sub2clash COPY --from=builder /app/sub2clash /app/sub2clash
# 设置容器的默认启动命令
ENTRYPOINT ["/app/sub2clash"] ENTRYPOINT ["/app/sub2clash"]