-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile
39 lines (33 loc) · 1.38 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
# syntax=docker/dockerfile:1
FROM --platform=linux/amd64 node:18.15.0-alpine as builder
RUN apk add --update --no-cache openssl
USER node
WORKDIR /tmp/build/app
COPY --chown=node:node package.json ./
COPY --chown=node:node yarn.lock ./
RUN yarn install
COPY --chown=node:node prisma ./prisma/
RUN yarn prisma generate
COPY --chown=node:node tsconfig.json ./
COPY --chown=node:node tsconfig.build.json ./
COPY --chown=node:node src ./src
RUN yarn build
FROM --platform=linux/amd64 node:18.15.0-alpine as ts-node-module-prod
RUN apk add --update --no-cache openssl
USER node
WORKDIR /usr/src/app
COPY --chown=node:node --from=builder /tmp/build/app/package.json ./
COPY --chown=node:node --from=builder /tmp/build/app/yarn.lock ./
RUN yarn install --frozen-lockfile --production
COPY --chown=node:node --from=builder /tmp/build/app/node_modules/@prisma ./node_modules/@prisma
COPY --chown=node:node --from=builder /tmp/build/app/node_modules/.prisma ./node_modules/.prisma
FROM --platform=linux/amd64 node:18.15.0-alpine
RUN apk add --update --no-cache openssl
USER node
WORKDIR /usr/src/app
COPY --chown=node:node --from=builder /tmp/build/app/package.json ./
COPY --chown=node:node --from=ts-node-module-prod /usr/src/app/node_modules ./node_modules
COPY --chown=node:node --from=builder /tmp/build/app/prisma ./prisma
COPY --chown=node:node --from=builder /tmp/build/app/dist ./
EXPOSE 3000
CMD ["main.js"]