From faaf5c366ae49294ff18185b4247bce1d46f2ff3 Mon Sep 17 00:00:00 2001 From: Nite07 Date: Thu, 18 Apr 2024 00:15:45 +0800 Subject: [PATCH] mod --- .goreleaser.yaml | 1 - .woodpecker/docker-nightly.yml | 2 +- .woodpecker/docker.yml | 4 ++-- Dockerfile | 19 ++----------------- 4 files changed, 5 insertions(+), 21 deletions(-) diff --git a/.goreleaser.yaml b/.goreleaser.yaml index f9a0533..7527be4 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -15,7 +15,6 @@ builds: - -s -w -X sub2clash/config.Version={{ .Version }} flags: - -trimpath - no_unique_dist_dir: true archives: - format: tar.gz format_overrides: diff --git a/.woodpecker/docker-nightly.yml b/.woodpecker/docker-nightly.yml index 676f025..22e9301 100644 --- a/.woodpecker/docker-nightly.yml +++ b/.woodpecker/docker-nightly.yml @@ -6,7 +6,7 @@ steps: - name: build image: woodpeckerci/plugin-docker-buildx settings: - platforms: linux/amd64 + platforms: linux/amd64,linux/arm64,linux/arm/v7 repo: nite07/sub2clash tag: nightly username: nite07 diff --git a/.woodpecker/docker.yml b/.woodpecker/docker.yml index 1832c15..00b14e9 100644 --- a/.woodpecker/docker.yml +++ b/.woodpecker/docker.yml @@ -5,9 +5,9 @@ steps: - name: build image: woodpeckerci/plugin-docker-buildx settings: - platforms: linux/amd64 + platforms: linux/amd64,linux/arm64,linux/arm/v7 repo: nite07/sub2clash - tag: ${CI_COMMIT_TAG} + auto_tag: true username: nite07 password: from_secret: docker_password diff --git a/Dockerfile b/Dockerfile index 222775d..81869ea 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,27 +1,12 @@ -# 使用官方 Golang 镜像作为构建环境 FROM golang:1.21-alpine as builder LABEL authors="nite07" - -# 设置工作目录 WORKDIR /app - -# 复制源代码到工作目录 COPY . . RUN go mod download - -# 获取参数 ARG version - -# 使用 -ldflags 参数进行编译 -RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w -X sub2clash/config.Version=${version}" -o sub2clash main.go +RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w -X sub2clash/config.Version=${version}" -o sub2clash . FROM alpine:latest - -# 设置工作目录 WORKDIR /app - -# 从 builder 镜像中复制出编译好的二进制文件 COPY --from=builder /app/sub2clash /app/sub2clash - -# 设置容器的默认启动命令 -ENTRYPOINT ["/app/sub2clash"] +ENTRYPOINT ["/app/sub2clash"] \ No newline at end of file