# Build stage: install all deps (build needs onnxruntime-web files from # node_modules) and emit the self-contained dist/ (scripts/build.ts). FROM oven/bun:1 AS build WORKDIR /app COPY package.json bun.lock bunfig.toml ./ RUN bun install --frozen-lockfile COPY src ./src COPY scripts ./scripts RUN bun run build # Runtime stage: production deps only. src/ and scripts/ are still needed — # src/index.ts is the server entrypoint and imports scripts/generate-icons. FROM oven/bun:1 AS runtime WORKDIR /app ENV NODE_ENV=production ENV DB_PATH=/app/data/app.db COPY package.json bun.lock bunfig.toml ./ RUN bun install --frozen-lockfile --production COPY src ./src COPY scripts ./scripts COPY --from=build /app/dist ./dist # SQLite lives under /app/data — mount a volume there to persist users/sessions. RUN mkdir -p /app/data && chown -R bun:bun /app/data USER bun EXPOSE 3000 CMD ["bun", "src/index.ts"]