28 lines
1.0 KiB
Docker
28 lines
1.0 KiB
Docker
# Dostalgia — Multi-stage Docker build
|
|
|
|
# ─── 1. Build frontend ───────────────────────────
|
|
FROM node:20-bookworm AS frontend
|
|
WORKDIR /build
|
|
COPY frontend/package.json frontend/package-lock.json ./
|
|
RUN npm ci 2>/dev/null || npm install --legacy-peer-deps
|
|
COPY frontend/ ./
|
|
RUN npx vite build
|
|
|
|
# ─── 2. Build Go binary ──────────────────────────
|
|
FROM golang:1.23-bookworm AS gobuild
|
|
WORKDIR /build
|
|
COPY go.mod ./
|
|
COPY *.go ./
|
|
COPY --from=frontend /build/dist ./frontend/dist/
|
|
RUN CGO_ENABLED=0 go build -o /dostalgia .
|
|
|
|
# ─── 3. Runtime ──────────────────────────────────
|
|
FROM debian:bookworm-slim
|
|
RUN apt-get update -qq && apt-get install -y -qq --no-install-recommends ca-certificates tzdata && rm -rf /var/lib/apt/lists/*
|
|
COPY --from=gobuild /dostalgia /dostalgia
|
|
VOLUME /data
|
|
EXPOSE 8765
|
|
ENV DOSTALGIA_DATA=/data
|
|
ENV PORT=8765
|
|
ENTRYPOINT ["/dostalgia"]
|