blob: ae6b17598621eb8422f8a4b6406b81bacb67b7ee [file] [log] [blame]
Chandan Ghosh5d55c412019-04-09 15:18:05 +05301# Check out https://hub.docker.com/_/node to select a new base image
Lukasz Rajewski3a31cda2022-09-18 23:41:04 +02002FROM node:16-slim
Chandan Ghosh5d55c412019-04-09 15:18:05 +05303
4# Set to a non-root built-in user `node`
5USER node
6
7# Create app directory (with user `node`)
8RUN mkdir -p /home/node/app
9
10WORKDIR /home/node/app
11
12# Install app dependencies
13# A wildcard is used to ensure both package.json AND package-lock.json are copied
14# where available (npm@5+)
15COPY --chown=node package*.json ./
16
17RUN npm install
18
19# Bundle app source code
20COPY --chown=node . .
21
22RUN npm run build
23
24# Bind to all network interfaces so that it can be mapped to the host OS
25ENV HOST=0.0.0.0 PORT=3000
26
27EXPOSE ${PORT}
28CMD [ "node", "." ]