diff --git a/.github/workflows/build_push_docker.yml b/.github/workflows/docker-build.yml similarity index 100% rename from .github/workflows/build_push_docker.yml rename to .github/workflows/docker-build.yml diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml deleted file mode 100644 index a380834..0000000 --- a/.github/workflows/pull_request.yml +++ /dev/null @@ -1,19 +0,0 @@ -name: 'Run unit tests' -on: - push: - branches: - - main - pull_request: - branches: - - main -jobs: - unit-test: - name: unit-test - runs-on: ubuntu-latest - steps: - - name: Checkout GitHub repo - uses: actions/checkout@v4 - - name: Print message - run: echo "Testing started" - - name: Run unit test - run: dotnet test diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-tests.yml similarity index 100% rename from .github/workflows/unit-test.yml rename to .github/workflows/unit-tests.yml diff --git a/README.md b/README.md index 048b6c3..f541baf 100644 --- a/README.md +++ b/README.md @@ -6,13 +6,30 @@ ## Table of Contents +## Table of Contents + 1. [Project Overview](#project-overview) -2. [Features](#features) -3. [Project Setup Instructions](#project-setup-instructions) -4. [Testing](#testing) -5. [Architecture](#architecture) -6. [Database Design](#database-design) -7. [Endpoints](#endpoints) + - [Frontend](#frontend) + - [Backend](#backend) + - [Swagger Documentation](#swagger-documentation) + - [Technologies](#technologies) +2. [Docker](#docker) +3. [GitHub Actions Workflow](#github-actions-workflow) +4. [Features](#features) + - [User Management](#user-management) + - [Admin Functionalities](#admin-functionalities) +5. [Project Setup Instructions](#project-setup-instructions) +6. [Testing](#testing) +7. [Architecture](#architecture) +8. [Database Design](#database-design) +9. [Endpoints](#endpoints) + - [Authentication](#authentication) + - [Category](#category) + - [Order](#order) + - [Product](#product) + - [Review](#review) + - [User](#user) +10. [Demo](#demo) ## Project Overview @@ -36,6 +53,34 @@ This backend project is build wtih ASP.NET Core, Entity Framework Core, and Post - Xunit - Microsoft Azure +## Docker + +To use the pre-built Docker image for this project, you can pull it from Docker Hub. Run the following command: + +``` +docker pull hasanmd91/ilhbackend +``` + +Once the image is pulled, you can run the Docker container using the following command: + +``` +docker run -p 8080:8080 hasanmd91/ilhbackend +``` + +Alternatively, you can run the docker-compose.yml file, you can use the following command to build and start the container + +``` +docker-compose up --build +``` + +## GitHub Actions Workflow + +The CI/CD pipeline is defined in the `.github/workflows` directory and it consists of the following stages: + +- **Build:** Build the project and dependencies. +- **Test:** Run unit tests and any other relevant tests. +- **Docker:** Build and push the docker image to the docker hub. + ## Features ### User Management: @@ -170,3 +215,7 @@ dotnet test | GET | `/api/user/{userId}` | | PATCH | `/api/user/{userId}` | | DELETE | `/api/user/{userId}` | + +## Demo + +[![Youtube Demo](https://img.youtube.com/vi/kPy1wzJwmSU/0.jpg)](https://www.youtube.com/watch?v=kPy1wzJwmSU) diff --git a/docker-compose.yml b/docker-compose.yml index 5f74965..b6af027 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,17 +1,38 @@ -version: '3' - +version: '3.8' +networks: + dev: + driver: bridge services: - # ilh-frontend service - ilh-frontend: - image: hasanmd91/ilhfrontend - ports: - - '3000:3000' - - # ilh-server service ilh-server: - image: docker.io/hasanmd91/ilh-backend + image: docker.io/library/ilh-server + depends_on: + - app_db + container_name: ilh-services ports: - '8080:8080' -networks: - dev: - driver: bridge + build: + context: . + dockerfile: Dockerfile + environment: + - ConnectionStrings__LocalDb=Host=localhost;Database=Ecom;Username=postgres;Password=postgres + - ASPNETCORE_URLS=http://+:8080 + - DB_CONNECTION_POOL_SIZE=20 + networks: + - dev + app_db: + image: postgres:latest + container_name: app_db + environment: + POSTGRES_DB: Ecom + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres + ports: + - '5433:5432' + restart: always + volumes: + - app_data:/var/lib/postgresql/data + networks: + - dev + +volumes: + app_data: