From a069c30906553764af7ee63c786a06d211112821 Mon Sep 17 00:00:00 2001 From: lxh2875931338 Date: Fri, 31 Jul 2026 22:24:26 +0800 Subject: [PATCH] =?UTF-8?q?2.4-LTS=E7=B4=A7=E6=80=A5=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=EF=BC=9Aalpine=E5=AE=98=E6=96=B9=E6=BA=90=E7=96=91=E4=BC=BC?= =?UTF-8?q?=E5=A4=B1=E6=95=88=EF=BC=8C=E5=A2=9E=E5=8A=A0=E5=9B=BD=E5=86=85?= =?UTF-8?q?=E6=BA=90=E5=8C=B9=E9=85=8D=E8=83=BD=E5=8A=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 3 ++- Dockerfile.txt | 30 ++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 Dockerfile.txt diff --git a/Dockerfile b/Dockerfile index 2b2d186..6f3d795 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,7 +17,8 @@ RUN CGO_ENABLED=0 GOOS=linux go build \ -o frpc-console . FROM alpine:latest - +# 先切换到国内镜像源,再安装包 +RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories RUN apk --no-cache add ca-certificates tzdata sqlite WORKDIR /app diff --git a/Dockerfile.txt b/Dockerfile.txt new file mode 100644 index 0000000..2b2d186 --- /dev/null +++ b/Dockerfile.txt @@ -0,0 +1,30 @@ +# 多阶段构建 +FROM golang:alpine AS builder + +WORKDIR /app + +COPY go.mod go.sum ./ + +RUN sed -i 's/go 1.2[6-9].*/go 1.21/' go.mod && go mod tidy +RUN go env -w GOPROXY=https://goproxy.cn,direct +RUN go mod download + +COPY . . + +# 编译时不注入任何版本信息(纯净二进制) +RUN CGO_ENABLED=0 GOOS=linux go build \ + -ldflags="-s -w" \ + -o frpc-console . + +FROM alpine:latest + +RUN apk --no-cache add ca-certificates tzdata sqlite + +WORKDIR /app + +COPY --from=builder /app/frpc-console /app/frpc-console +COPY static/ /app/static/ + +EXPOSE 9300 + +ENTRYPOINT ["/app/frpc-console"] \ No newline at end of file