gmq版本
This commit is contained in:
31
Dockerfile
31
Dockerfile
@@ -3,26 +3,25 @@ FROM golang:1.26-alpine3.23 AS builder
|
||||
|
||||
RUN apk add --no-cache git ca-certificates tzdata
|
||||
|
||||
RUN go env -w GO111MODULE=on \
|
||||
&& go env -w GOPROXY=https://goproxy.cn,direct \
|
||||
&& go env -w GOPRIVATE=gitea.com/red-future/*
|
||||
ENV GO111MODULE=on
|
||||
ENV GOPROXY=https://goproxy.cn,direct
|
||||
ENV CGO_ENABLED=0
|
||||
ENV GOTOOLCHAIN=auto
|
||||
ENV GOPRIVATE=gitea.com/red-future/common
|
||||
|
||||
# 配置Git URL重定向到私有仓库
|
||||
RUN git config --global url."http://116.204.74.41:3000/red-future/".insteadOf "https://gitea.com/red-future/" \
|
||||
&& git config --global url."http://116.204.74.41:3000/red-future/".insteadOf "http://gitea.com/red-future/"
|
||||
# 配置git使用私有Gitea仓库(带Token认证)
|
||||
RUN git config --global url."http://x-token-auth:9b31146aa8c10a7cb4f2e49dcee0934a223be1076289810e1ad98b968066c2bc@116.204.74.41:3000/red-future/common.git".insteadOf "https://gitea.com/red-future/common.git" && \
|
||||
git config --global credential.helper store
|
||||
|
||||
WORKDIR /build
|
||||
|
||||
COPY go.mod go.sum ./
|
||||
|
||||
RUN go mod download && go mod verify
|
||||
|
||||
# 复制父目录的 common 模块(因为 go.mod 中使用了本地 replace)
|
||||
COPY ../common /build/common
|
||||
COPY . .
|
||||
|
||||
RUN go mod tidy
|
||||
RUN go mod download && go mod tidy
|
||||
|
||||
# 编译生成 rag 二进制
|
||||
RUN CGO_ENABLED=0 GOOS=linux go build -v -o rag .
|
||||
RUN go build -ldflags="-s -w" -o main ./main.go
|
||||
|
||||
# 第二阶段:运行
|
||||
FROM alpine:3.23
|
||||
@@ -34,12 +33,12 @@ RUN apk add --no-cache ca-certificates tzdata && \
|
||||
WORKDIR /app
|
||||
|
||||
# 复制编译好的二进制文件
|
||||
COPY --from=builder /build/rag .
|
||||
COPY config.yml ./
|
||||
COPY --from=builder /build/main .
|
||||
COPY --from=builder /build/config.yml ./
|
||||
|
||||
# 创建日志目录
|
||||
RUN mkdir -p /logs /app/resource/log/run /app/resource/log/server
|
||||
|
||||
EXPOSE 3006
|
||||
|
||||
CMD ["./rag"]
|
||||
CMD ["./main"]
|
||||
|
||||
Reference in New Issue
Block a user