forked from BretFisher/example-voting-app
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
32 lines (24 loc) · 868 Bytes
/
Dockerfile
File metadata and controls
32 lines (24 loc) · 868 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
FROM node:12-buster-slim
ENV PORT 80
EXPOSE 80
# add curl for healthcheck
# add tini for proper signal handling
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
# IRL use 'apt-cache policy <package-name>' to get installed versions
# example: curl=7.64.0-4+deb10u2
curl \
tini \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# have nodemon available for local dev use (file watching)
RUN npm install -g nodemon@2.*
# always copy in package dependencies and install them before copying in source code
# this ensures proper build layer caching and makes for faster re-builds
COPY package*.json ./
RUN npm ci \
&& npm cache clean --force \
# move node_modules up a directory so they still work with bind-mounted code in development
&& mv /app/node_modules /node_modules
COPY . .
CMD ["tini", "--", "node", "server.js"]