🎨 优化dockerfile,优化路由匹配
This commit is contained in:
13
Dockerfile
13
Dockerfile
@@ -17,7 +17,13 @@ COPY web/ ./
|
||||
RUN npm run build
|
||||
|
||||
# 阶段2: 构建后端
|
||||
FROM golang:1.21-alpine as backend-builder
|
||||
FROM golang:1.23-alpine as backend-builder
|
||||
|
||||
# 设置环境变量允许 Go 自动下载工具链
|
||||
ENV GO111MODULE=on \
|
||||
GOPROXY=https://goproxy.cn,direct \
|
||||
CGO_ENABLED=0 \
|
||||
GOTOOLCHAIN=auto
|
||||
|
||||
WORKDIR /app/server
|
||||
|
||||
@@ -25,10 +31,7 @@ WORKDIR /app/server
|
||||
COPY server/go.mod server/go.sum ./
|
||||
|
||||
# 下载依赖
|
||||
RUN go env -w GO111MODULE=on \
|
||||
&& go env -w GOPROXY=https://goproxy.cn,direct \
|
||||
&& go env -w CGO_ENABLED=0 \
|
||||
&& go mod download
|
||||
RUN go mod download
|
||||
|
||||
# 复制后端源码
|
||||
COPY server/ ./
|
||||
|
||||
Reference in New Issue
Block a user