forked from freeCodeCamp/freeCodeCamp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.Dockerfile
28 lines (23 loc) · 928 Bytes
/
server.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
FROM node:14.17.3-alpine as builder
USER node
WORKDIR /home/node/build
COPY --chown=node:node . .
RUN npm ci
RUN npm run build:curriculum
RUN npm run build:server
FROM node:14.17.3-alpine
USER node
WORKDIR /home/node/api
# get and install deps
COPY --from=builder --chown=node:node /home/node/build/package.json /home/node/build/package-lock.json ./
COPY --from=builder --chown=node:node /home/node/build/api-server/package.json /home/node/build/api-server/package-lock.json api-server/
RUN npm ci --production --ignore-scripts \
&& cd api-server \
&& npm ci --production \
&& npm cache clean --force
COPY --from=builder --chown=node:node /home/node/build/api-server/lib/ api-server/lib/
COPY --from=builder --chown=node:node /home/node/build/utils/ utils/
COPY --from=builder --chown=node:node /home/node/build/config/ config/
WORKDIR /home/node/api/api-server
CMD ["npm", "start"]
# TODO: don't copy mocks/fixtures