-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
52 lines (38 loc) · 1.1 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
# ---- Base Node ----
FROM node:10.14.2-jessie AS base
# Create app directory
WORKDIR /app
# ----------------------
# ---- Dependencies ----
# ----------------------
FROM base AS dependencies
# A wildcard is used to ensure both package.json AND package-lock.json are copied
COPY package*.json ./
RUN npm install
# ---------------
# ---- Build ----
# ---------------
FROM dependencies AS build
COPY auto auto/
COPY src src/
COPY test test/
COPY .eslintrc.yaml ./
ENTRYPOINT ["./auto/build.sh"]
# ----------------
# -- Prerelease --
# ----------------
FROM build as prerelease
# don't want to prune the build image, because I need to run tests in it.
# don't want to prune the release image, since alpine is missing some tools to do it with (namely python)
RUN npm prune --production
# ----------------
# --- Release ----
# ----------------
FROM node:10.14.2-alpine AS release
# Create app directory
WORKDIR /app
# production dependencies
COPY --from=prerelease /app/node_modules ./node_modules/
COPY --from=dependencies /app/package*.json ./
COPY --from=build /app/src ./src/
ENTRYPOINT ["node", "src/server.js"]