forked from LaserWeb/LaserWeb4
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
44 lines (39 loc) · 983 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
#
# ---- Base Node ----
FROM node:10-alpine AS base
# set working directory
WORKDIR /usr/src/app
# copy project file
COPY package*.json ./
EXPOSE 8000
# copy app sources
COPY . .
#
# ---- Dependencies ----
FROM base AS dependencies
RUN apk add --no-cache make gcc g++ python python3 linux-headers udev git
# install node packages
RUN npm set progress=false && npm config set depth 0
RUN npm ci
#
# ---- Test ----
# run linters, setup and tests
FROM dependencies AS test
#RUN npm run lint && npm run setup && npm run test
RUN npm run test
#
# ---- Release ----
FROM base AS release
WORKDIR /usr/src/app
# copy production node_modules
COPY --from=dependencies /usr/src/app/node_modules node_modules
# define CMD
CMD [ "npm", "run", "start-server" ]
#
# ---- Dev ----
FROM dependencies AS dev
RUN npm install && npm install -g nodemon
# copy production node_modules
COPY --from=dependencies /usr/src/app/node_modules node_modules
# define CMD
CMD [ "npm", "run", "start-server" ]