CircleCI in recent years have shown their commitment in recent years in ensuring that they make the task of continous integration and delivery way more easier and fast for devs to setup. And amongst the many CI/CD tools in the market today, i think CircleCI have one of the easiest and straight forward approach. Making use of containers.
However with the list of programming languages they wrote convenience images for they somehow neglected .Net...anyways the joke is on them. I recently explored using them on a project, and came up with the following.
I dug into their convenience images and found out that they just basically have docker bundled with the language's base image.
So i was easily able to come up with one for .Net Core. i used .Net Core 3, but same approach should work on previous versions
CircleCi Convenience images for .Net Core
After building the image i pushed it to Docker Hub
Create a folder in the root directory of your file named .circleci within it create a file called config.yml
then define the following
version: 2 jobs: build: docker: - image: jetcipher/circleci-dotnet-core:3.0 steps: - checkout - run: name: Restore command: dotnet restore working_directory: MyProject.Api - run: name: Build command: dotnet build -c Release working_directory: MyProject.Api - run: name: Running Tests command: dotnet test working_directory: MyProject.Tests - setup_remote_docker: docker_layer_caching: true - run: name: Build and push Docker image command: | docker build -t MyProject . echo $DOCKER_PWD | docker login -u $DOCKER_LOGIN --password-stdin docker tag boku herocod3r/MyProject docker push herocod3r/MyProject
MyProject is your project's name, im sure you get the flow 🙂
On your CircleCI project's dashboard setup the enviroment variables DOCKER_PWD your docker password and DOCKER_LOGIN your docker id
Commit and push, voila your build should now be running !!