Spaces:
Running
Running
| # syntax=docker/dockerfile:1 | |
| # Pin to a Bun major (https://hub.docker.com/r/oven/bun/tags). The build | |
| # stages share the full image; the runtime uses the slim variant. | |
| FROM oven/bun:1 AS base | |
| WORKDIR /app | |
| # 1. Install all dependencies (including dev) for the Vite build. | |
| FROM base AS install | |
| COPY package.json bun.lock ./ | |
| RUN bun install --frozen-lockfile | |
| # 2. Build the static SvelteKit SPA into ./dist | |
| FROM base AS build | |
| ENV NODE_ENV=production | |
| COPY --from=install /app/node_modules ./node_modules | |
| COPY . . | |
| RUN bun run build | |
| # 3. Final image: just the bun runtime + dist/ + serve.ts. | |
| FROM oven/bun:1-slim AS release | |
| WORKDIR /app | |
| COPY --from=build /app/dist ./dist | |
| COPY --from=build /app/serve.ts ./serve.ts | |
| # oven/bun ships a `bun` user with UID 1000, which Hugging Face Spaces expects. | |
| USER bun | |
| ENV PORT=7860 | |
| ENV HOST=0.0.0.0 | |
| EXPOSE 7860 | |
| CMD ["bun", "run", "serve.ts"] | |