# syntax=docker/dockerfile:1.7
FROM oven/bun:1-alpine AS builder
WORKDIR /app

COPY package.json bun.lock* bun.lockb* ./
RUN bun install --frozen-lockfile

COPY tsconfig*.json vite.config.ts index.html ./
COPY openapi.json ./
COPY public ./public
COPY src ./src

RUN bun run gen:api && bun run build

# Runtime image is intentionally generic — the nginx config is volume-mounted
# from ../deploy/nginx.conf by compose so ops can iterate without rebuilds.
FROM nginx:1.27-alpine AS runtime
COPY --from=builder /app/dist /usr/share/nginx/html
EXPOSE 80
