-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdockerfile
More file actions
28 lines (27 loc) · 1 KB
/
Copy pathdockerfile
File metadata and controls
28 lines (27 loc) · 1 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
# Build stage
FROM node:20-slim AS build
WORKDIR /app
# openssl needed by the prisma query engine (loaded during svelte-kit build analysis)
RUN apt-get update && apt-get install -y --no-install-recommends openssl ca-certificates && rm -rf /var/lib/apt/lists/*
RUN npm install -g pnpm@8
COPY package.json pnpm-lock.yaml ./
RUN pnpm install
COPY . .
RUN npx prisma generate
RUN pnpm run build
# Run stage
FROM node:20-slim
WORKDIR /app
# openssl needed by the prisma query engine
RUN apt-get update && apt-get install -y --no-install-recommends openssl ca-certificates && rm -rf /var/lib/apt/lists/*
RUN npm install -g pnpm@8
COPY --from=build /app/build ./build
COPY --from=build /app/prisma ./prisma
COPY package.json pnpm-lock.yaml ./
RUN pnpm install --prod
# server entry + the in-process ws module it imports from source
COPY server.js ./
COPY src/lib/server/ws ./src/lib/server/ws
EXPOSE 3000
# migrations run before start so the container is self-migrating
CMD ["sh", "-c", "npx prisma migrate deploy && node server.js"]