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