-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathDockerfile
31 lines (26 loc) · 819 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
###############################################################################
# Step 1 : Builder image
#
FROM node:9-alpine AS builder
# Define working directory and copy source
WORKDIR /home/node/app
COPY . .
# Install dependencies and build whatever you have to build
# (babel, grunt, webpack, etc.)
RUN npm install && npm run build
###############################################################################
# Step 2 : Run image
#
FROM node:9-alpine
ENV NODE_ENV=production
WORKDIR /home/node/app
# Install deps for production only
COPY ./package* ./
RUN npm install && \
npm cache clean --force
# Copy builded source from the upper builder stage
COPY --from=builder /home/node/app/build ./build
# Expose ports (for orchestrators and dynamic reverse proxies)
EXPOSE 3000
# Start the app
CMD npm start