-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
39 lines (28 loc) · 1016 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
32
33
34
35
36
37
38
39
# Simple docker setup for the API server
FROM node:16
EXPOSE 3001
# This might be handy during debugging
ENV NPM_CONFIG_LOGLEVEL info
ENV NODE_ENV=production
# Install global npm modules to the non-root user (called `node` in the default Node container)
ENV NPM_CONFIG_PREFIX=/home/node/.npm-global
ENV PATH=$PATH:/home/node/.npm-global/bin
# FIXME we might want to run under Tini, but for now we should run docker with --init instead
# FIXME see https://github.com/nodejs/docker-node/blob/main/docs/BestPractices.md#handling-kernel-signals for the explanation around this
WORKDIR /home/node/app
# Install our dependencies
COPY package*.json ./
RUN npm install
# Copy the API code into the container
COPY app.js app.js
COPY model model
COPY model.js model.js
COPY db.js db.js
COPY routes routes
COPY migrations migrations
COPY seeds seeds
COPY knexfile.js knexfile.js
# How we want to start the server
CMD ["node", "/home/node/app/app.js"]
# Now we're at the end, set the user we want to run as
USER node