This project is a simple Node.js application that serves as a demonstration for setting up a CI/CD pipeline using GitHub Actions.
The application is built with Express.js and exposes a single endpoint /. When accessed, it returns a JSON response.
server.js: The main entry point of the application. It starts a server on port 8080.package.json: Defines the project's dependencies. The only dependency isexpress.Dockerfile: Contains instructions to build a Docker image for the application.
The typical workflow for this application is as follows:
- Local Development: A developer clones the repository and makes changes to the application. They can run the application locally for testing.
- Push to GitHub: Once the changes are ready, the developer pushes them to the GitHub repository.
- CI/CD Pipeline: A GitHub Actions workflow is triggered on every push to the
mainbranch. This workflow uses GitHub-hosted runners and would typically:- Build the Docker image using the
Dockerfile. - Push the Docker image to a container registry (like Docker Hub).
- Deploy the application to AWS by running a container from the image.
- Build the Docker image using the
To run the application locally, you need to have Node.js and npm installed.
- Clone the repository:
git clone https://github.com/sharvil-lade/actions-cicd.git
- Navigate to the project directory:
cd actions-cicd - Install the dependencies:
npm install
- Start the server:
The server will be running on
node server.js
http://localhost:8080.
To run the application using Docker:
- Build the Docker image:
docker build -t actions-cicd . - Run the Docker container:
The server will be running on
docker run -p 8080:8080 actions-cicd
http://localhost:8080.