Skip to content

About

CI/CD with GitHub Actions for a simple Dockerized .NET API. Automatically builds and pushes Docker images to Docker Hub on every commit to master.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

6 Commits

Folders and files

Repository files navigation

CI/CD Dockerized DotNet API

A simple .NET API with GitHub Actions CI/CD pipeline that automatically builds and pushes Docker images to Docker Hub.

How to Run (Using Docker CLI)

  1. Pull the image from Docker Hub:

    docker pull amiromumi/dockerized-dotnetapi-cicd:latest
  2. Run the Docker container:

    docker run -d -p 2503:80 --name mydockerapi-container-cicd amiromumi/dockerized-dotnetapi-cicd
  3. Access the API:

CI/CD Pipeline

This project includes a GitHub Actions workflow that:

  • Builds the Docker image on every push to the master branch.
  • Automatically pushes the image to Docker Hub using your credentials.

Workflow file path:

.github/workflows/ci-dockerized-dotnet-api.yml

Environment Configuration

By default, the API runs in Production mode inside the Docker container.
You can override this by passing an environment variable:

docker run -d -p 2503:80 -e ASPNETCORE_ENVIRONMENT=Development --name mydockerapi-container-cicd amiromumi/dockerized-dotnetapi-cicd

Check environment by visiting:

Logging Configuration

The application logs are stored inside the container:

  • Path: /app/logs/log.txt
  • Automatically creates the folder if it doesn't exist

Project Structure

CI-CD-DotNetAPI/
│-- .github/
│   └── workflows/
│       └── ci-dockerized-dotnet-api.yml
│-- Dockerfile
│-- Dockerized-DotNetAPI.csproj
│-- Program.cs
│-- logs/ (generated at runtime)

Notes

  • Demonstrates CI/CD using GitHub Actions with Docker Hub integration.
  • Supports both manual Docker CLI execution and automated image builds.
  • Make sure Docker is installed and the container port is available.

About

CI/CD with GitHub Actions for a simple Dockerized .NET API. Automatically builds and pushes Docker images to Docker Hub on every commit to master.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages