-
Notifications
You must be signed in to change notification settings - Fork 17
/
Dockerfile
41 lines (30 loc) · 1.05 KB
/
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
FROM node:18-slim as builder
# OpenSSL is required to build prisma on M1 Mac
# (See https://github.com/prisma/prisma/issues/861#issuecomment-881992292)
RUN apt-get update
RUN apt-get install -y openssl
WORKDIR /usr/src/app
COPY package.json yarn.lock ./
RUN yarn install
COPY . .
RUN yarn prisma:setup
RUN yarn build
FROM node:18-slim as runner
RUN apt-get update
RUN apt-get install -y openssl
WORKDIR /usr/src/app
ARG NODE_ENV=production
ENV NODE_ENV=${NODE_ENV}
COPY package.json yarn.lock ./
RUN yarn install --production
# dev dependnecies are required for generating the prisma client,
# so we copy the one generated in the builder container
COPY --from=builder /usr/src/app/node_modules/.prisma ./node_modules/.prisma
COPY --from=builder /usr/src/app/node_modules/@prisma/client ./node_modules/@prisma/client
# Nest.js build output
COPY --from=builder /usr/src/app/dist ./dist
# Remix build output (client)
COPY --from=builder /usr/src/app/public ./public
# Remix build output (server)
COPY --from=builder /usr/src/app/build ./build
CMD ["node", "dist/main"]