forked from cboard-org/cboard
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
52 lines (29 loc) · 1.04 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
FROM node:8-alpine AS base
# Make a directory for our source and build artifacts
RUN mkdir -p /home/cboard/build
WORKDIR /home/cboard
# Copy only the package.json file so we can install and cache dependencies
COPY package.json /home/cboard
# --- Create "dependencies" intermediate stage
FROM base AS dependencies
RUN npm set progress=false
# Install only modules listed in "dependencies" in package.json
RUN npm install --only=production
# Cache the runtime dependencies for later stage
RUN cp -R node_modules prod_node_modules
# Install all runtime and dev dependencies for building the code
RUN npm install
# --- End "dependencies" stage
# --- Create the "build" intermediate stage
FROM dependencies AS build
COPY . .
RUN npm run build
# --- End "build" stage
# --- Create the "release" image without devDependencies
FROM base AS release
COPY --from=dependencies /home/cboard/prod_node_modules ./node_modules
COPY --from=build /home/cboard/build ./build
RUN npm install -g serve
EXPOSE 5000
CMD ["serve", "-s", "build"]
# --- End "release" stage