forked from Michigan-Tech-Courses/backend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
37 lines (24 loc) · 811 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
FROM node:20-slim AS builder
ENV NODE_ENV production
ENV APP_HOME=/opt/node/app
USER node:node
WORKDIR $APP_HOME
COPY --chown=node:node package.json ./
COPY --chown=node:node yarn.lock ./
COPY --chown=node:node prisma ./prisma
RUN yarn install --frozen-lockfile --production=false
COPY --chown=node:node . .
RUN yarn build
FROM node:20-slim
# Required by Prisma
RUN apt-get update -y && apt-get install -y openssl && rm -rf /var/lib/apt/lists/*
ENV NODE_ENV production
ENV APP_HOME=/opt/node/app
USER node:node
WORKDIR $APP_HOME
COPY --chown=node:node package.json ./
COPY --chown=node:node yarn.lock ./
COPY --chown=node:node prisma ./prisma
RUN yarn install --frozen-lockfile --production=true && yarn cache clean
COPY --from=builder --chown=node:node $APP_HOME/dist ./dist
CMD ["yarn", "start"]