Anto Subash.

dotnet
abp
microservice
docker
.NET Microservice with ABP -Part : 10

Docker and CI/CD

This is the part 10 of the series: .NET Microservice with ABP

Posts in the Series

Part 1. Initial Setup

Part 2. Shared Project

Part 3. Administration Service

Part 4. Identity Service

Part 5. SaaS Service

Part 6. DB Migration

Part 7. Yarp and Tye

Part 8. Identity server and Angular App

Part 9. Distributed event bus

Part 10. Docker and CI/CD (this post)

Part 11. Add a New service

Part 12. Central Logging

Table of contents

Intro

In this post we will see how to add docker support to all the services and setup a CI/CD pipeline with github actions.

Docker support

Docker support can be added easily by using visual studio. since all the project is available in the solution vs will create a Docker file and add it to the project. In this we will use the Identity server it will be similar for all the other services.

To add Docker support right click on the Identity server project and choose add.

Add Docker

In the add menu choose docker support

Add Menu

In the docker file option choose linux

Docker Options

The final docker file will look like this. Here is the location of this sample file https://github.com/antosubash/AbpMicroservice/blob/main/apps/Tasky.IdentityServer/Dockerfile

Docker file

We have to do this to all the services.

CI/CD

Here is the sample github action file.

name: Docker Image CI

on:
  push:
    branches: [ main ]
  pull_request:
    branches: [ main ]

jobs:

  build:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v2
    - name: Build the Gateway Docker image
      run: docker build . --file gateway/Tasky.Gateway/Dockerfile --tag gateway:dev
    - name: Build the IdentityServer Docker image
      run: docker build . --file apps/Tasky.IdentityServer/Dockerfile --tag identityserver:dev
    - name: Build the Administration Docker image
      run: docker build . --file services/administration/host/Tasky.AdministrationService.HttpApi.Host/Dockerfile --tag administration:dev
    - name: Build the IdentityService Docker image
      run: docker build . --file services/identity/host/Tasky.IdentityService.HttpApi.Host/Dockerfile --tag identityservice:dev
    - name: Build the SaaS Docker image
      run: docker build . --file services/saas/host/Tasky.SaaSService.HttpApi.Host/Dockerfile --tag saas:dev
Buy Me a Coffee at ko-fi.com