Member-only story

Dockerize a Node.Js App — with Job Scenario/DevOps ticket

GABRIEL OKOM
3 min readOct 11, 2023

--

Creating a Dockerized Node.js App and Deploying it on a Remote Server

Prerequisites:

  1. Access to a remote server (App Server 3 in this example) with Docker installed.
  2. A Node.js application with a package.json file and a server.js file. These should be placed in the /node_app directory on the remote server.
  3. Basic knowledge of Docker and Node.js.

Objectives:

  1. Dockerize a Node.js app.
  2. Deploy the Docker container on a remote server.
  3. Expose the Node.js app on a specific port.
  4. Test the deployed app using a curl command.

Job Scenario:

There is a requirement to Dockerize a Node app and to deploy the same on App Server 3. Under /node_app directory on App Server 3, we have already placed a package.json file that describes the app dependencies and server.js file that defines a web app framework.

Create a Dockerfile (name is case sensitive) under /node_app directory:

Use any node image as the base image.

Install the dependencies using package.json file.

Use server.js in the CMD.

Expose port 5000.

The build image should be named as nautilus/node-web-app.

--

--

GABRIEL OKOM
GABRIEL OKOM

Written by GABRIEL OKOM

MSc Cyber Security and Computer Forensics | Certified DevOps Engineer

No responses yet