|
|
FROM golang:1.20-alpine AS builder |
|
|
|
|
|
|
|
|
WORKDIR /app |
|
|
|
|
|
|
|
|
RUN apk add --no-cache git make gcc musl-dev nodejs npm |
|
|
|
|
|
|
|
|
RUN git clone https://github.com/lejianwen/rustdesk-api.git . |
|
|
|
|
|
|
|
|
RUN go mod tidy |
|
|
|
|
|
|
|
|
RUN mkdir -p resources/admin |
|
|
RUN git clone https://github.com/lejianwen/rustdesk-api-web resources/rustdesk-api-web |
|
|
WORKDIR /app/resources/rustdesk-api-web |
|
|
RUN npm install |
|
|
RUN npm run build |
|
|
RUN cp -ar dist/* ../admin/ |
|
|
|
|
|
|
|
|
WORKDIR /app |
|
|
RUN go generate generate_api.go |
|
|
|
|
|
|
|
|
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o rustdesk-api . |
|
|
|
|
|
|
|
|
FROM alpine:latest |
|
|
|
|
|
|
|
|
RUN apk --no-cache add ca-certificates |
|
|
|
|
|
|
|
|
WORKDIR /app |
|
|
|
|
|
|
|
|
COPY --from=builder /app/rustdesk-api . |
|
|
COPY --from=builder /app/resources /app/resources |
|
|
COPY --from=builder /app/config.yaml /app/config.yaml |
|
|
|
|
|
|
|
|
EXPOSE 8080 |
|
|
|
|
|
|
|
|
CMD ["./rustdesk-api"] |
|
|
|