-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
48 lines (37 loc) · 1.09 KB
/
Dockerfile
File metadata and controls
48 lines (37 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# Multi-stage build
# Stage 1: Build Frontend
FROM node:22-alpine AS frontend-builder
# Install pnpm
RUN corepack enable && corepack prepare pnpm@latest --activate
WORKDIR /app/web
COPY web/package.json web/pnpm-lock.yaml ./
RUN pnpm install --frozen-lockfile
COPY web/ ./
RUN pnpm run build
# Stage 2: Build Backend
FROM golang:1.24-alpine AS backend-builder
WORKDIR /app
# Install build tools (gcc needed for cgo/sqlite)
RUN apk add --no-cache gcc musl-dev
COPY go.mod go.sum ./
RUN go mod download
COPY . .
# Copy built frontend assets
COPY --from=frontend-builder /app/web/dist ./web/dist
# Build with CGO disabled (using modernc.org/sqlite)
RUN CGO_ENABLED=0 GOOS=linux go build -o msp-server ./cmd/msp
# Stage 3: Runtime
FROM alpine:latest
WORKDIR /app
# No extra sqlite libs needed for modernc.org/sqlite
COPY --from=backend-builder /app/msp-server .
# Create data directory
RUN mkdir -p /data
# Set environment variable to disable auto-open browser
ENV MSP_NO_AUTO_OPEN=1
# Expose default port
EXPOSE 8099
# Volume for data (config, db) and media
VOLUME ["/data", "/media"]
# Run
CMD ["./msp-server"]