Initial commit
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
# 多阶段构建 Dockerfile for MeshRay
|
||||
|
||||
# Stage 1: Build frontend
|
||||
FROM node:20-alpine AS frontend-builder
|
||||
WORKDIR /app/web
|
||||
COPY web/package*.json ./
|
||||
RUN npm install
|
||||
COPY web/ ./
|
||||
RUN npm run build
|
||||
|
||||
# Stage 2: Build backend
|
||||
FROM golang:1.21-alpine AS backend-builder
|
||||
WORKDIR /app
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
COPY . .
|
||||
COPY --from=frontend-builder /app/web/dist ./web/dist
|
||||
RUN CGO_ENABLED=1 GOOS=linux go build -ldflags="-w -s" -o meshray ./cmd/meshray
|
||||
|
||||
# Stage 3: Runtime
|
||||
FROM alpine:latest
|
||||
RUN apk --no-cache add ca-certificates iptables iproute2 wireguard-tools
|
||||
WORKDIR /app
|
||||
COPY --from=backend-builder /app/meshray .
|
||||
COPY configs/config.example.yaml config.yaml
|
||||
EXPOSE 9531
|
||||
CMD ["./meshray"]
|
||||
Reference in New Issue
Block a user