feat: add Docker deployment, update install script, and project configs
- Add Dockerfile and docker-compose.yml for containerized deployment - Rewrite install.sh for Docker-based setup (multi-distro support) - Add Go module files (go.mod, go.sum) for WGRplane backend - Add wgrplane.service systemd unit for Go backend - Add CI verification scripts in scripts/ - Update README.md with Docker deployment docs - Update .gitignore for binaries and .sisyphus/
This commit is contained in:
+29
@@ -0,0 +1,29 @@
|
||||
## Multi-stage Dockerfile for WGRplane
|
||||
## Stage 1: Go backend build
|
||||
FROM --platform=$BUILDPLATFORM golang:1.21-alpine AS builder-go
|
||||
WORKDIR /src
|
||||
COPY go.mod go.sum ./
|
||||
RUN --mount=type=cache,target=/root/.cache/go-build \
|
||||
go mod download
|
||||
COPY app ./app
|
||||
ENV CGO_ENABLED=0
|
||||
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \
|
||||
go build -o /bin/wgrplane ./app
|
||||
|
||||
## Stage 2: Frontend build (Vue 3)
|
||||
FROM node:20-alpine AS frontend-builder
|
||||
WORKDIR /src/app/frontend
|
||||
COPY app/frontend/package*.json ./
|
||||
RUN npm ci
|
||||
COPY app/frontend/ .
|
||||
RUN npm run build
|
||||
|
||||
## Stage 3: Production image
|
||||
FROM alpine:latest
|
||||
RUN apk --no-cache add ca-certificates
|
||||
WORKDIR /root
|
||||
COPY --from=builder-go /bin/wgrplane /usr/local/bin/wgrplane
|
||||
COPY --from=frontend-builder /src/app/frontend/dist /var/www/frontend
|
||||
ENV APP_FRONTEND_DIR=/var/www/frontend
|
||||
EXPOSE 10087
|
||||
ENTRYPOINT ["/usr/local/bin/wgrplane"]
|
||||
Reference in New Issue
Block a user