forked from TickLabVN/ssps-be
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
35 lines (24 loc) · 889 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
ARG NODE_VERSION=18.13.0
################## Stage 1 ##################
FROM node:${NODE_VERSION}-alpine as development
WORKDIR /app
#Installing necessary packages for @thiagoelg/node-printer
RUN apk --no-cache add python3 cups-dev make g++
COPY package.json yarn.lock tsconfig.json tsconfig.compile.json jest.config.js ./
COPY ./src ./src
COPY ./prisma ./prisma
RUN yarn install --prod && yarn db:generate
RUN yarn add -D jest @types/jest ts-jest
RUN yarn test
RUN yarn build
COPY ./prisma ./dist/prisma
COPY package.json ./dist/
################## Stage 2 ##################
FROM node:${NODE_VERSION}-alpine as production
WORKDIR /app
RUN apk --no-cache add python3 cups-dev
ENV NODE_ENV=production
COPY --chown=node:node --from=development /app/dist .
COPY --chown=node:node --from=development /app/node_modules node_modules
EXPOSE 8080
CMD yarn db:deploy && node src/index.js