Dockerfile

This commit is contained in:
2026-03-16 17:04:22 +08:00
parent 47b1adf9ab
commit 89fb77a87a
2 changed files with 11 additions and 5 deletions

View File

@@ -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: 运行

2
go.mod
View File

@@ -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