From 89fb77a87a3a91e319513fe21a8c28dbc0138983 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=96=8C?= <259278618@qq.com> Date: Mon, 16 Mar 2026 17:04:22 +0800 Subject: [PATCH] Dockerfile --- Dockerfile | 14 ++++++++++---- go.mod | 2 +- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 2ca7bb4..8759969 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,17 +10,23 @@ ENV GO111MODULE=on ENV GOPROXY=https://goproxy.cn,direct ENV CGO_ENABLED=0 ENV GOTOOLCHAIN=auto +ENV GOPRIVATE=gitea.com/red-future/common + +# 配置git使用私有Gitea仓库 +RUN git config --global url."http://116.204.74.41:3000/red-future/common.git".insteadOf "https://gitea.com/red-future/common.git" && \ + git config --global credential.helper store + +# 设置GIT凭据 +RUN echo "http://x-token-auth:297685158fb953a1bad6c45e16f72472ca6e9866@116.204.74.41:3000" > ~/.git-credentials WORKDIR /build COPY go.mod go.sum ./ -COPY common ./common - -RUN go mod download - COPY main.go ./ COPY config.yml ./ +RUN go mod download && go mod tidy + RUN go build -ldflags="-s -w" -o main ./main.go # 阶段2: 运行 diff --git a/go.mod b/go.mod index 9da0db6..85b6c24 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/gogf/gf/v2 v2.9.5 ) -replace gitea.com/red-future/common => ./common +//replace gitea.com/red-future/common => ../common require ( github.com/BurntSushi/toml v1.5.0 // indirect