Dockerized Service

Use GitHub Actions to Deploy a Dockerized Node.js Service

Start building, submit solution and get feedback from the community.
2Submit Solution·
5 upvotes10 upvotes

The goal of this project is to dockerize a simple Node.js service and deploy it to a remote server using GitHub Actions. You will also practice secrets management.

Requirements

There are 4 parts to this project:

  • Step 1 — Creating a Node.js service
  • Step 2 — Dockerizing the Node.js service
  • Step 3 — Setup a remote Linux Server
  • Step 4 — Deploying the Dockerized Node.js service to a remote server using GitHub Actions

Part 1: Creating a Node.js service

You are required to create a simple Node.js service with two routes:

  • / route - which simply returns Hello, world!
  • /secret route - protected by Basic Auth

Project should have a .env file with the following variables:

  • SECRET_MESSAGE - the secret message that the /secret route should return
  • USERNAME - the username for the Basic Auth
  • PASSWORD - the password for the Basic Auth

When user visits the /secret route, they should be prompted for the username and password. If the username and password are correct, they should be able to see the secret message. If the username and password are incorrect, they should see an error message.

Part 2: Dockerizing the Node.js service

Create a Dockerfile for the Node.js service that will build a Docker image. You should be able to run the Docker image locally. Make sure that the .env file is not included in the Docker image.

Part 3: Setup a remote Linux Server

Setup a remote Linux server on either DigitalOcean, AWS, or any other provider. You can either set it up manually by using SSH or use a mix of Ansible or Terraform from previous projects.

Part 4: Deploy the Dockerized Node.js service

Create a workflow that will build a Docker image and push it to the container registry. The workflow should then deploy the Docker image to the remote server. Feel free to explore secrets management in GitHub Actions. I will leave the implementation details to you.


Once you are done with the project, you will have practiced dockerizing applications, setting up remote servers, implementing CI/CD workflows and secrets management.

Found a mistake? Help us improve.

Actively Maintained

We are always improving our content, adding new resources and adding features to enhance your learning experience.

Join the Community

roadmap.sh is the 7th most starred project on GitHub and is visited by hundreds of thousands of developers every month.

Rank 7th  out of 28M!

296K

GitHub Stars

Star us on GitHub
Help us reach #1

+90k every month

+1M

Registered Users

Register yourself
Commit to your growth

+1.5k every month

28K

Discord Members

Join on Discord
Join the community

Roadmaps Best Practices Guides Videos FAQs YouTube

roadmap.sh by @kamrify

Community created roadmaps, best practices, projects, articles, resources and journeys to help you choose your path and grow in your career.

© roadmap.sh · Terms · Privacy · Advertise ·

ThewNewStack

The top DevOps resource for Kubernetes, cloud-native computing, and large-scale development and deployment.