This commit is contained in:
Tao Chen
2024-10-29 18:48:37 +08:00
parent 7d83226655
commit 17305b6a6f
2 changed files with 21 additions and 7 deletions

View File

@@ -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 && \

View File

@@ -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
- ./conf:/app/conf # config
# - ./resources:/app/resources # 静态资源
restart: unless-stopped