-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
41 lines (38 loc) · 808 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
#
# -- Base node image with app
#
FROM node:10-alpine AS base
WORKDIR /usr/src/app
COPY package.json package-lock.json app.js ./
RUN mkdir -p ./bin ./routes
COPY bin bin
COPY public public
COPY views views
COPY routes routes
#
# -- Dependencies
#
FROM base as dependencies
WORKDIR /usr/src/app
RUN npm install --only=production
RUN cp -R node_modules node_modules_production
RUN npm install
#
# Potentially running test, linting, security check +++
#
FROM dependencies as test
WORKDIR /usr/src/app
#COPY test test
#RUN ["npm","test"]
COPY .eslintrc.json .eslintignore ./
RUN npm run lint
RUN npm audit
#
# Release image
#
FROM base as release
WORKDIR /usr/src/app
COPY --from=dependencies /usr/src/app/node_modules_production ./node_modules
EXPOSE 3001
ENV NODE_ENV=production
ENTRYPOINT [ "npm", "start"]