An open API service indexing awesome lists of open source software.

https://github.com/cashblaze127/nextjs-docker-cicd

Nextjs CI/CD in Devops, Automatically Deployment with Docker
https://github.com/cashblaze127/nextjs-docker-cicd

ci-cd devops docker docker-image nextjs

Last synced: 3 months ago
JSON representation

Nextjs CI/CD in Devops, Automatically Deployment with Docker

Awesome Lists containing this project

README

        

# 🚀 CI/CD Pipeline for Next.js Project with Docker

This repository demonstrates the implementation of a robust CI/CD pipeline for a **Next.js** project using **Docker**. The setup ensures seamless building, testing, and deployment of the application, leveraging containerized environments for consistency and reliability.

## 📩 Contact Me on Telegram

For inquiries, collaborations, or support, feel free to reach out:

[![Telegram Contact](https://img.shields.io/badge/Telegram-Contact%20Me-blue?logo=telegram&style=for-the-badge)](https://t.me/cashblaze127)

## 📂 Project Files

### Key Configuration Files

1. Dockerfile

Defines the application containerization process for building and running the Next.js project.

2. docker-compose.yml

Simplifies multi-container setup, ensuring smooth orchestration for local development and production environments.

3. deploy.yml

Automates the deployment workflow using GitHub Actions, facilitating continuous integration and deployment.

---

### 📜 Pipeline Workflow

1. Build Stage
- Docker builds the Next.js application image using the **Dockerfile**.
- Dependencies are installed, and the application is compiled.
2. Test Stage
- Run automated tests to validate the application functionality.
3. Deployment Stage
- The **deploy.yml** GitHub Actions workflow pushes the Docker image to a container registry (e.g., Docker Hub or AWS ECR).
- Deploys the container to the desired environment (e.g., AWS, DigitalOcean, or a Kubernetes cluster).

---

## 🛠️ How to Use

### Prerequisites

- Docker and Docker Compose installed on your system.
- Access to a container registry (Docker Hub, AWS ECR, etc.).
- A configured GitHub repository for CI/CD integration.

### Setup Instructions

1. Clone the repository:

```
git clone https://github.com/cashblaze127/CI-CD-NextJs.git
cd CI-CD-NextJs
```

2. Build and run the container locally:

```
docker-compose up --build
```

3. Push changes to the GitHub repository to trigger the CI/CD pipeline:

- GitHub Actions will handle the build, test, and deployment stages defined in the `deploy.yml` file.

## 📄 File Descriptions

#### Dockerfile

A multi-stage Dockerfile to optimize the build process:

#### docker-compose.yml

Defines services for local development:

#### deploy.yml

GitHub Actions workflow for CI/CD:

### 🌟 Features

- Containerized development environment for Next.js.
- Automated testing and deployment using GitHub Actions.
- Simplified multi-container orchestration with Docker Compose.
- Scalable and production-ready architecture.

### Feel free to tweak this further based on specific project details or add any additional steps.