|
|
@@ -4,7 +4,7 @@ ARG BUILDARCH=amd64
|
|
4
|
4
|
|
|
5
|
5
|
# Stage 1: Builder Stage
|
|
6
|
6
|
# FROM golang:${GO_VERSION}-alpine AS builder
|
|
7
|
|
-FROM crazymax/xgo:${GO_VERSION} AS builder
|
|
|
7
|
+FROM crazymax/xgo:${GO_VERSION} AS builder-backend
|
|
8
|
8
|
|
|
9
|
9
|
# Set up working directory
|
|
10
|
10
|
WORKDIR /app
|
|
|
@@ -27,7 +27,7 @@ RUN CGO_ENABLED=1 GOOS=linux go build -a \
|
|
27
|
27
|
-installsuffix cgo -o release/apimain cmd/apimain.go
|
|
28
|
28
|
|
|
29
|
29
|
# Stage 2: Frontend Build Stage (builder2)
|
|
30
|
|
-FROM node:18-alpine AS builder2
|
|
|
30
|
+FROM node:18-alpine AS builder-admin-frontend
|
|
31
|
31
|
|
|
32
|
32
|
# Set working directory
|
|
33
|
33
|
WORKDIR /frontend
|
|
|
@@ -50,12 +50,12 @@ WORKDIR /app
|
|
50
|
50
|
RUN apk add --no-cache tzdata file
|
|
51
|
51
|
|
|
52
|
52
|
# Copy the built application and resources from the builder stage
|
|
53
|
|
-COPY --from=builder /app/release /app/
|
|
54
|
|
-COPY --from=builder /app/conf /app/conf/
|
|
55
|
|
-COPY --from=builder /app/resources /app/resources/
|
|
56
|
|
-COPY --from=builder /app/docs /app/docs/
|
|
|
53
|
+COPY --from=builder-backend /app/release /app/
|
|
|
54
|
+COPY --from=builder-backend /app/conf /app/conf/
|
|
|
55
|
+COPY --from=builder-backend /app/resources /app/resources/
|
|
|
56
|
+COPY --from=builder-backend /app/docs /app/docs/
|
|
57
|
57
|
# Copy frontend build from builder2 stage
|
|
58
|
|
-COPY --from=builder2 /frontend/dist/ /app/resources/admin/
|
|
|
58
|
+COPY --from=builder-admin-frontend /frontend/dist/ /app/resources/admin/
|
|
59
|
59
|
|
|
60
|
60
|
# Ensure the binary is correctly built and linked
|
|
61
|
61
|
RUN file /app/apimain && \
|