Dockerfile
This commit is contained in:
14
Dockerfile
14
Dockerfile
@@ -10,17 +10,23 @@ ENV GO111MODULE=on
|
|||||||
ENV GOPROXY=https://goproxy.cn,direct
|
ENV GOPROXY=https://goproxy.cn,direct
|
||||||
ENV CGO_ENABLED=0
|
ENV CGO_ENABLED=0
|
||||||
ENV GOTOOLCHAIN=auto
|
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
|
WORKDIR /build
|
||||||
|
|
||||||
COPY go.mod go.sum ./
|
COPY go.mod go.sum ./
|
||||||
COPY common ./common
|
|
||||||
|
|
||||||
RUN go mod download
|
|
||||||
|
|
||||||
COPY main.go ./
|
COPY main.go ./
|
||||||
COPY config.yml ./
|
COPY config.yml ./
|
||||||
|
|
||||||
|
RUN go mod download && go mod tidy
|
||||||
|
|
||||||
RUN go build -ldflags="-s -w" -o main ./main.go
|
RUN go build -ldflags="-s -w" -o main ./main.go
|
||||||
|
|
||||||
# 阶段2: 运行
|
# 阶段2: 运行
|
||||||
|
|||||||
2
go.mod
2
go.mod
@@ -7,7 +7,7 @@ require (
|
|||||||
github.com/gogf/gf/v2 v2.9.5
|
github.com/gogf/gf/v2 v2.9.5
|
||||||
)
|
)
|
||||||
|
|
||||||
replace gitea.com/red-future/common => ./common
|
//replace gitea.com/red-future/common => ../common
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/BurntSushi/toml v1.5.0 // indirect
|
github.com/BurntSushi/toml v1.5.0 // indirect
|
||||||
|
|||||||
Reference in New Issue
Block a user