🎨 优化dockerfile,优化路由匹配

This commit is contained in:
2026-03-03 17:47:19 +08:00
parent 8e52b854ea
commit f8306be916
2 changed files with 17 additions and 7 deletions

View File

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