Files
wotra/Containerfile
2026-08-20 16:34:55 +02:00

39 lines
1.1 KiB
Docker

# ── Stage 1: build Svelte frontend ──────────────────────────────────────────
FROM node:24-alpine AS web-builder
WORKDIR /app/web
COPY web/package*.json ./
RUN npm ci --legacy-peer-deps
COPY web/ ./
RUN npm run build
# ── Stage 2: build Go binary ─────────────────────────────────────────────────
FROM golang:1.27-alpine AS go-builder
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
COPY . .
COPY --from=web-builder /app/web/build ./web/build
RUN go build -tags production -o wotra ./cmd/wotra
# ── Stage 3: minimal runtime image ───────────────────────────────────────────
FROM alpine:3.21
RUN adduser -D -u 1000 wotra
WORKDIR /data
USER wotra
COPY --from=go-builder /app/wotra /usr/local/bin/wotra
EXPOSE 8080
ENV PORT=8080 \
DB_PATH=/data/wotra.db \
TZ=UTC
ENTRYPOINT ["/usr/local/bin/wotra"]