CI/CD for Dotnet 6 WebAPI using GitLab runner On-Premise
Using GitLab runner to setup CI/CD Pipelines for a Containerized Dotnet 6 Web Application.
Debug mode:
appsetting.json
: Change MSQL Server for TodoItemConnectionString
with a valid server name.
TodoItem.WebAPI
and run the project.TodoItem.WebAPI
, then dotnet run
command.Docker:
docker-compose -f docker-compose.yml -f docker-compose.override.yml build
TodoItem.WebAPI
: todoitemwebapi
Portainer
: Portainer
TodoItem Sql Server Db
: TodoItemDb, User: sa, Password: Bob12345678
1 --> How to run GitLab CE + GitLab Runner - All On-Premise(Not working in Windows OS - Network Issue ):
docker-compose -f docker-compose.gitlab-all-onpremise-networking-issue-in-windows.yml up -d
http://localhost:9090/{username|root}/{projectname}/-/settings/ci_cd
, and expend runners.Enable shared runners for this project
docker-compose exec gitlab-runner \
gitlab-runner register \
--non-interactive \
--url "[gitlab-ce IP](https://stackoverflow.com/a/20686101)" \
--registration-token "[gitlab-runner token](https://devops.stackexchange.com/a/4617)" \
--executor docker \
--description "Dotnet 6 Web.API Runner" \
--docker-image "docker:stable"
2 --> How to run GitLab Runner - Hybrid:
docker-compose -f docker-compose.gitlabrunner-on-premise.yml up -d
https://gitlab.com/{username|root}/{projectname}/-/settings/ci_cd
, and expend runners.Enable shared runners for this project
- Shared runners are paid docker-compose exec gitlab-runner \
gitlab-runner register \
--non-interactive \
--url "https://gitlab.com/" \
--registration-token "project runner token" \
--executor docker \
--description "Dotnet 6 Web.API Runner" \
--docker-image "docker:stable"