# Dockerfile for Oikos API server. The SPA is no longer embedded (see
# plans/2026-07-12-wails-desktop-app.md 0.1) — it's built and deployed
# separately as static files (see `make ui` / `make deploy-ui`).
# Stage 1: build Go binary
FROM golang:1.26-alpine AS builder

RUN apk add --no-cache git ca-certificates

WORKDIR /build
COPY go.mod go.sum ./
RUN go mod download

COPY . .

RUN CGO_ENABLED=0 go build -o /oikos -tags timetzdata -ldflags="-s -w" ./cmd/oikos

# --- Runtime: alpine with SSH + ping for scheduler checks ---
FROM alpine:3.21

RUN apk add --no-cache ca-certificates openssh-client-default

COPY --from=builder /oikos /oikos
COPY --from=builder /build/seeds /seeds
COPY --from=builder /build/migrations /migrations

ENTRYPOINT ["/oikos"]
