File size: 877 Bytes
91806f8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# 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"]