From 10a82cebd51e12d483483602608f830916c134ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=96=8C?= <259278618@qq.com> Date: Wed, 18 Mar 2026 10:40:33 +0800 Subject: [PATCH] Dockerfile --- .gitignore | 1 + Dockerfile | 16 +++++++++------- go.mod | 2 +- 3 files changed, 11 insertions(+), 8 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..61069b7 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/.idea/* \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index f9f355c..8dc2699 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,18 +7,20 @@ RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories ENV GO111MODULE=on ENV GOPROXY=https://goproxy.cn,direct ENV CGO_ENABLED=0 -ENV GOPRIVATE=gitee.com/red-future---jilin-g/* +ENV GOTOOLCHAIN=auto +ENV GOPRIVATE=gitea.com/red-future/common -ARG GITEE_TOKEN -RUN git config --global url."https://oauth2:cf5eb6b356c7040747eb5eda8b48a617@gitee.com/".insteadOf "https://gitee.com/" +# 配置git使用私有Gitea仓库 +RUN git config --global url."http://x-token-auth:297685158fb953a1bad6c45e16f72472ca6e9866@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 . . -# 强制更新 common 包到 master 最新版本 -RUN go get -u gitee.com/red-future---jilin-g/common@master - RUN go mod tidy && go mod download RUN go build -ldflags="-s -w" -o main ./main.go @@ -48,4 +50,4 @@ USER appuser EXPOSE 8808 -CMD ["./main"] \ No newline at end of file +CMD ["./main"] diff --git a/go.mod b/go.mod index 4fdd570..2833f91 100644 --- a/go.mod +++ b/go.mod @@ -17,7 +17,7 @@ require ( go.mongodb.org/mongo-driver/v2 v2.4.1 ) -replace gitea.com/red-future/common v0.0.3 => ../common +//replace gitea.com/red-future/common v0.0.3 => ../common require ( github.com/BurntSushi/toml v1.5.0 // indirect