-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
35 lines (27 loc) · 1.23 KB
/
Copy pathDockerfile
File metadata and controls
35 lines (27 loc) · 1.23 KB
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
33
34
35
# syntax=docker/dockerfile:1
# ---- build stage: install everything, generate prisma client, build the app ----
FROM oven/bun:1 AS build
WORKDIR /app
# Install deps against the committed lockfile for reproducible builds.
COPY package.json bun.lockb ./
RUN bun install --frozen-lockfile
COPY . .
# adapter-node needs the prisma client generated before svelte build (types + runtime).
RUN bunx prisma generate && bun run build
# ---- runtime stage: slim image with only what we need to serve ----
FROM oven/bun:1-slim AS runtime
WORKDIR /app
ENV NODE_ENV=production
# Full node_modules from the build stage so the generated prisma client and the
# prisma CLI (used by migrate deploy on startup) are both present.
COPY --from=build /app/node_modules ./node_modules
COPY --from=build /app/build ./build
COPY --from=build /app/prisma ./prisma
COPY --from=build /app/package.json ./package.json
# Needed by prisma/seed.ts at startup (the only src file the runtime references).
COPY --from=build /app/src/types/abilitiesSeed.ts ./src/types/abilitiesSeed.ts
COPY docker-entrypoint.sh ./
RUN chmod +x docker-entrypoint.sh
# 3000 = SvelteKit HTTP (adapter-node), 8081 = game websocket server (hooks.server.ts)
EXPOSE 3000 8081
ENTRYPOINT ["./docker-entrypoint.sh"]