You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Dockerfile
+9-12Lines changed: 9 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -1,34 +1,31 @@
1
1
# 构建阶段 1: 前端构建 (Frontend)
2
2
FROM node:20-alpine AS frontend-builder
3
3
WORKDIR /app/web
4
-
COPYgo-4gproxy/web/package*.json ./
4
+
COPY web/package*.json ./
5
5
RUN npm ci
6
-
COPYgo-4gproxy/web/ .
6
+
COPY web/ .
7
7
RUN npm run build
8
8
9
9
# 构建阶段 2: 后端构建 (Backend)
10
10
FROM golang:1.24-alpine AS backend-builder
11
-
ARG GH_PAT=""
12
11
WORKDIR /app
13
12
14
13
# 启用 Go 工具链自动下载
15
14
ENV GOTOOLCHAIN=auto
16
-
ENV GOPRIVATE=github.com/iniwex5/*
17
-
ENV GONOSUMDB=github.com/iniwex5/*
15
+
ENV GOWORK=off
18
16
19
17
# 安装构建依赖
20
18
RUN apk add --no-cache git
21
19
22
-
# 配置 Git 以支持拉取私有库
23
-
RUN if [ -n "${GH_PAT}" ]; then git config --global url."https://x-access-token:${GH_PAT}@github.com/iniwex5/".insteadOf "https://github.com/iniwex5/"; fi
24
-
25
20
# 复制 go mod 文件
26
-
COPY go-4gproxy/go.mod go-4gproxy/go.sum ./
27
-
21
+
COPY go.mod go.sum ./
28
22
RUN go mod download
29
23
30
24
# 复制源代码 (不包含 internal/web/dist,这将在下一步从前端构建阶段复制)
31
-
COPY go-4gproxy/ .
25
+
COPY cmd ./cmd
26
+
COPY internal ./internal
27
+
COPY pkg ./pkg
28
+
COPY engine ./engine
32
29
33
30
# 复制构建好的前端资源到 internal/web/dist 以便嵌入
34
31
# 必须在 go build 之前完成
@@ -41,7 +38,7 @@ RUN ls -la internal/web/dist/ && echo "Frontend assets copied successfully"
0 commit comments