-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
53 lines (29 loc) · 793 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
FROM node:16 AS build-stage
WORKDIR /usr/src/app
COPY ./client .
RUN npm ci
RUN npm run build
################################################################
FROM node:16 AS test-stage
WORKDIR /usr/src/app
COPY --chown=node:node --from=build-stage /usr/src/app/build ./build
COPY --chown=node:node . .
RUN rm -rf client
RUN npm ci
ARG SECRET
ARG MONGODB_URI_TEST
ENV SECRET = ${SECRET}
ENV MONGODB_URI_TEST = ${MONGODB_URI_TEST}
RUN npm run test
################################################################
FROM node:16
WORKDIR /usr/src/app
COPY --chown=node:node --from=test-stage /usr/src/app .
RUN rm -rf tests
RUN npm ci --only=production
ARG MONGODB_URI
ARG SECRET
ENV MONGODB_URI = ${MONGODB_URI}
ENV SECRET = ${SECRET}
USER node
CMD ["npm", "run", "start"]