How to host NodeJs app on Docker Container

Daniel Mesizah
1 min readJan 5, 2023

To host a Node.js app in a Docker container, you will need to create a Dockerfile that specifies how to build the Docker image for your app. Here is an example Dockerfile that you can use as a starting point:

FROM node:latest
# Create app directory
WORKDIR /usr/src/app
# Install app dependencies
# A wildcard is used to ensure both package.json AND package-lock.json are copied
# where available (npm@5+)
COPY package*.json ./
RUN npm install# Bundle app source
COPY . .

--

--

Daniel Mesizah

Coder who likes to share what he knows with the rest of the world