28 lines
916 B
Docker
28 lines
916 B
Docker
# Multi-stage build for Go + Node.js Backend
|
|
# Stage 1: Build Go binary
|
|
FROM golang:1.24-alpine AS builder
|
|
# Use latest stable go that works (docker tag might not have 1.25.6 yet, alpine is fine)
|
|
# Since the go.mod says 1.25.6, we'll let it use the toolchain if 1.24 is the base, or we just rely on standard go compilation.
|
|
RUN apk add --no-cache git make gcc musl-dev
|
|
|
|
WORKDIR /src
|
|
COPY protonvpn-wg-confgen/ ./
|
|
ENV GOTOOLCHAIN=auto
|
|
RUN go build -o /bin/protonvpn-wg-confgen cmd/protonvpn-wg/main.go
|
|
|
|
# Stage 2: Node.js Backend Production setup
|
|
FROM node:22-alpine
|
|
WORKDIR /app
|
|
|
|
# Install CA certs needed for Proton API calls
|
|
RUN apk add --no-cache ca-certificates tzdata
|
|
|
|
# Copy the compiled Go binary from Stage 1
|
|
COPY --from=builder /bin/protonvpn-wg-confgen /usr/local/bin/protonvpn-wg-confgen
|
|
|
|
# Setup the Node JS backend
|
|
COPY backend/package.json ./
|
|
RUN npm install
|
|
COPY backend/ ./
|
|
CMD ["npm", "run", "dev"]
|