|
|
@@ -26,6 +26,19 @@ RUN CGO_ENABLED=1 GOOS=linux go build -a \
|
|
26
|
26
|
-ldflags "-s -w --extldflags '-static -fpic'" \
|
|
27
|
27
|
-installsuffix cgo -o release/apimain cmd/apimain.go
|
|
28
|
28
|
|
|
|
29
|
+# Stage 2: Frontend Build Stage (builder2)
|
|
|
30
|
+FROM node:18-alpine AS builder2
|
|
|
31
|
+
|
|
|
32
|
+# Set working directory
|
|
|
33
|
+WORKDIR /frontend
|
|
|
34
|
+
|
|
|
35
|
+RUN apk update && apk add git --no-cache
|
|
|
36
|
+
|
|
|
37
|
+# Clone the frontend repository
|
|
|
38
|
+RUN git clone https://github.com/lejianwen/rustdesk-api-web .
|
|
|
39
|
+
|
|
|
40
|
+# Install npm dependencies and build the frontend
|
|
|
41
|
+RUN npm install && npm run build
|
|
29
|
42
|
|
|
30
|
43
|
# Stage 2: Final Image
|
|
31
|
44
|
FROM alpine:latest
|
|
|
@@ -40,6 +53,9 @@ RUN apk add --no-cache tzdata file
|
|
40
|
53
|
COPY --from=builder /app/release /app/
|
|
41
|
54
|
COPY --from=builder /app/conf /app/conf/
|
|
42
|
55
|
COPY --from=builder /app/resources /app/resources/
|
|
|
56
|
+COPY --from=builder /app/docs /app/docs/
|
|
|
57
|
+# Copy frontend build from builder2 stage
|
|
|
58
|
+COPY --from=builder2 /frontend/dist/ /app/resources/admin/
|
|
43
|
59
|
|
|
44
|
60
|
# Ensure the binary is correctly built and linked
|
|
45
|
61
|
RUN file /app/apimain && \
|