-
Notifications
You must be signed in to change notification settings - Fork 46
/
Copy pathDockerfile
60 lines (42 loc) · 1.08 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
FROM --platform=linux/amd64 node:18-alpine as pre-production
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
#COPY . .
COPY package.json .
COPY package-lock.json .
COPY backend/package.json ./backend/package.json
COPY backend/package-lock.json ./backend/package-lock.json
RUN npm i
RUN #npm ci --prefix backend --omit dev
RUN npm ci --prefix backend
COPY . .
RUN npm run build
FROM --platform=linux/amd64 node:18-alpine as production
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
ENV NODE_ENV=production
COPY --from=pre-production /usr/src/app/backend/dist ./dist
COPY --from=pre-production /usr/src/app/backend/node_modules ./node_modules
COPY backend/package.json .
COPY backend/package-lock.json .
#RUN npm ci --omit dev
RUN mkdir -p ./config
RUN ln -s /usr/src/app/config /config
CMD [ "npm", "run", "start:prod" ]
#FROM node:18 as development
#
#ENV NODE_ENV=development
#
#RUN mkdir -p /usr/src/app
#WORKDIR /usr/src/app
#
#COPY package.json .
#COPY package-lock.json .
#
#RUN npm i
#
#RUN mkdir -p ./config
#
#RUN ln -s /usr/src/app/config /config
#
#CMD [ "npm", "run", "dev" ]