-
Notifications
You must be signed in to change notification settings - Fork 5
/
Dockerfile
42 lines (33 loc) · 1.47 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
# Base image upon which subsequent data will be added.
# Found on Docker Hub: https://hub.docker.com/_/node/
FROM node:8.9.4-alpine
# Name of the author or maintainer as a single string.
MAINTAINER Rob McLarty <[email protected]> (https://robmclarty.com)
# Install system dependencies using Alpine Linux package manager.
# List of apk packages: https://pkgs.alpinelinux.org/packages
# (e.g., need gcc to compile npm packages with C bindings)
RUN apk add --update make gcc g++ git python
# Create directory to store app code.
RUN mkdir -p /opt/app/config/keys
# Change the current working directory to the new app directory.
WORKDIR /opt/app
# Install app dependencies from local source code.
# e.g., `COPY file1 file2 file3 /path/in/container`
COPY package.json .npmrc .sequelizerc /opt/app/
COPY config/server.js config/database.js /opt/app/config/
# Use env secrets instead of this
COPY config/keys /opt/app/config/keys
COPY server /opt/app/server
COPY db /opt/app/db
RUN npm install --production
# NOTE: node-alpine creates a group "node" and a user "node" and adds that user
# to that group for use in running the node app as a limited-priviledge user.
# Because this is included in the base image, we don't need to define this again
# with the following command, so it has been commented out.
# RUN groupadd -r node && useradd -r -g node node
# Set the user when running this image.
USER node
# Open ports to outside world.
EXPOSE 3000
# Start main process.
CMD ["node", "./server/start.js"]