-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathDockerfile
More file actions
36 lines (27 loc) · 924 Bytes
/
Dockerfile
File metadata and controls
36 lines (27 loc) · 924 Bytes
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
FROM keymetrics/pm2:latest-alpine
LABEL maintainer "Stratos Pavlakis"
# Create the app directory
RUN mkdir -p /app
RUN chown -R node:node /app
# The Docker node image includes a non-root user named 'node'.
# A recommended security practice is to avoid running containers as root, and
# to restrict capabilities within the container to only those required by the app.
# Therefore, we use the 'node' user to run the app.
USER node
# Switch to the app directory
WORKDIR /app
# Copy in the NPM dependency files
COPY package.json yarn.lock ./
# Install app dependencies
RUN yarn install --ignore-engines
# Copy in the src files
# Ideally we would want to delete src afterwards
# but this cannot be done in Docker and since
# this is a boilerplate
COPY ecosystem.config.js .
COPY src ./src
# Build and set production
RUN yarn build
ENV NODE_ENV production
# Launch it
CMD ["pm2-runtime", "start", "ecosystem.config.js"]