-
Notifications
You must be signed in to change notification settings - Fork 5
/
Dockerfile
43 lines (34 loc) · 1000 Bytes
/
Dockerfile
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
36
37
38
39
40
41
42
43
################
# Build assets #
################
FROM node:22.12 AS build
WORKDIR /app
# Install global node modules: pnpm
RUN npm install -g [email protected]
ENV PNPM_ARGS="--frozen-lockfile --ignore-scripts"
# Install Node modules
COPY package.json pnpm-lock.yaml ./
RUN pnpm install ${PNPM_ARGS}
# Generate Prisma schemas
COPY prisma ./prisma
RUN pnpm prisma:gen
COPY . .
ENV NODE_ENV=production
RUN pnpm build
RUN pnpm install --production ${PNPM_ARGS}
####################
# Production image #
####################
FROM node:22.12-slim AS production
WORKDIR /app
RUN set -xe && \
apt-get update && \
apt-get install -y --no-install-recommends openssl && \
apt-get autoremove -y && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /usr/share/man/* /usr/share/doc/*
COPY --chown=node:node --from=build /app/build build
COPY --chown=node:node --from=build /app/node_modules node_modules
USER node
ENV NODE_ENV=production
CMD ["--enable-source-maps", "build/server/main.js"]