Dockerfile

This commit is contained in:
2026-03-18 10:40:33 +08:00
parent e58dd3529d
commit 10a82cebd5
3 changed files with 11 additions and 8 deletions

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
/.idea/*

View File

@@ -7,18 +7,20 @@ RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
ENV GO111MODULE=on ENV GO111MODULE=on
ENV GOPROXY=https://goproxy.cn,direct ENV GOPROXY=https://goproxy.cn,direct
ENV CGO_ENABLED=0 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 # 配置git使用私有Gitea仓库
RUN git config --global url."https://oauth2:cf5eb6b356c7040747eb5eda8b48a617@gitee.com/".insteadOf "https://gitee.com/" 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 WORKDIR /build
COPY . . COPY . .
# 强制更新 common 包到 master 最新版本
RUN go get -u gitee.com/red-future---jilin-g/common@master
RUN go mod tidy && go mod download RUN go mod tidy && go mod download
RUN go build -ldflags="-s -w" -o main ./main.go RUN go build -ldflags="-s -w" -o main ./main.go
@@ -48,4 +50,4 @@ USER appuser
EXPOSE 8808 EXPOSE 8808
CMD ["./main"] CMD ["./main"]

2
go.mod
View File

@@ -17,7 +17,7 @@ require (
go.mongodb.org/mongo-driver/v2 v2.4.1 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 ( require (
github.com/BurntSushi/toml v1.5.0 // indirect github.com/BurntSushi/toml v1.5.0 // indirect