diff --git a/Dockerfile.dev b/Dockerfile.dev index 04df912..d0e517b 100644 --- a/Dockerfile.dev +++ b/Dockerfile.dev @@ -26,6 +26,19 @@ RUN CGO_ENABLED=1 GOOS=linux go build -a \ -ldflags "-s -w --extldflags '-static -fpic'" \ -installsuffix cgo -o release/apimain cmd/apimain.go +# Stage 2: Frontend Build Stage (builder2) +FROM node:18-alpine AS builder2 + +# Set working directory +WORKDIR /frontend + +RUN apk update && apk add git --no-cache + +# Clone the frontend repository +RUN git clone https://github.com/lejianwen/rustdesk-api-web . + +# Install npm dependencies and build the frontend +RUN npm install && npm run build # Stage 2: Final Image FROM alpine:latest @@ -40,6 +53,9 @@ RUN apk add --no-cache tzdata file COPY --from=builder /app/release /app/ COPY --from=builder /app/conf /app/conf/ COPY --from=builder /app/resources /app/resources/ +COPY --from=builder /app/docs /app/docs/ +# Copy frontend build from builder2 stage +COPY --from=builder2 /frontend/dist/ /app/resources/admin/ # Ensure the binary is correctly built and linked RUN file /app/apimain && \ diff --git a/docker-compose.yaml b/docker-compose.yaml index 4ecf1e0..d015bc1 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -3,20 +3,18 @@ services: build: context: . dockerfile: Dockerfile.dev - args: - - DOCS="" - image: lejianwen/rustdesk-api + # image: lejianwen/rustdesk-api container_name: rustdesk-api environment: - TZ=Asia/Shanghai - RUSTDESK_API_RUSTDESK_ID_SERVER=192.168.1.66:21116 - RUSTDESK_API_RUSTDESK_RELAY_SERVER=192.168.1.66:21117 - - RUSTDESK_API_RUSTDESK_API_SERVER=http://localhost:21114 + - RUSTDESK_API_RUSTDESK_API_SERVER=http://127.0.0.1:21114 - RUSTDESK_API_RUSTDESK_KEY=123456789 ports: - 21114:21114 volumes: - ./data/rustdesk/api:/app/data #将数据库挂载出来方便备份 - # - ./conf:/app/conf # config - restart: unless-stopped - # command: sleep infnite \ No newline at end of file + - ./conf:/app/conf # config + # - ./resources:/app/resources # 静态资源 + restart: unless-stopped \ No newline at end of file