Files
wotra/Containerfile
T

38 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 CGO_ENABLED=0 go build -trimpath -o /out/wotra .
# ── Stage 3: minimal runtime image ───────────────────────────────────────────
FROM alpine:3.21
RUN apk add --no-cache ca-certificates && adduser -D -u 1000 wotra
WORKDIR /pb_data
USER wotra
COPY --from=go-builder /out/wotra /usr/local/bin/wotra
EXPOSE 8080
VOLUME /pb_data
ENTRYPOINT ["/usr/local/bin/wotra"]
CMD ["serve", "--http=0.0.0.0:8080", "--dir=/pb_data"]