
Deploy Node Application on an EC2 Instance using CI/CD Pipeline.
Project Overview This is a minimal Node.js/Express backend server. The application itself is straightforward — a single Express 5 app (index.js) that listens on port 3000 and returns "Hello World in AWS EC2!" at the root route. The real substance of the project lies in its deployment infrastructure. CI/CD Pipeline The pipeline is split across two GitHub Actions workflows that chain together to form a complete automated delivery process from code commit to live deployment on AWS EC2. There are two parts of these settings. In your root directory, create a file named Dockerfile ` FROM node:18-alpine WORKDIR /app COPY package*.json ./ COPY . . RUN npm install EXPOSE 3000 RUN ["chmod", "+x", "./entrypoint.sh"] ENTRYPOINT [ "sh","./entrypoint.sh" ] ` For best practice, run your project using the entrypoint.sh: #!/bin/bash node index.js then in order to set DOCKER_HUB_TOKEN & DOCKER_USER_NAME , First register on https://app.docker.com Create a repository named the same as Github repository. G
Continue reading on Dev.to DevOps
Opens in a new tab



