31 lines
902 B
Docker
31 lines
902 B
Docker
# syntax=docker/dockerfile:1
|
|
|
|
# ---- Builder: install deps + build a standalone Node server (.output/) ----
|
|
FROM oven/bun:1 AS builder
|
|
WORKDIR /app
|
|
|
|
# Install dependencies against the committed lockfile
|
|
COPY package.json bun.lock ./
|
|
RUN bun install --frozen-lockfile
|
|
|
|
# Copy the rest of the source. .env is copied too so Vite bakes the
|
|
# VITE_SUPABASE_* values into the client bundle at build time (public-safe).
|
|
COPY . .
|
|
|
|
# Build with the Nitro node-server preset -> self-contained .output/
|
|
ENV NITRO_PRESET=node-server
|
|
RUN bun run build
|
|
|
|
# ---- Runner: run the built server on Node (no install needed, .output is standalone) ----
|
|
FROM node:22-slim AS runner
|
|
WORKDIR /app
|
|
ENV NODE_ENV=production
|
|
# Nitro node-server reads HOST/PORT; 0.0.0.0:3000 is the default we expose.
|
|
ENV HOST=0.0.0.0
|
|
ENV PORT=3000
|
|
|
|
COPY --from=builder /app/.output ./.output
|
|
|
|
EXPOSE 3000
|
|
CMD ["node", ".output/server/index.mjs"]
|