TeamCity on docker, building dotnet core and Angular

I wanted to setup build server for a personal project I’m working on, and I didn’t want to have any dependencies on the machine, so that I could move it easily. And, if I’m honest, the build server was a personal project as well.

Requirements

  • Build a dotnet core project
  • Build an angular project
  • No dependencies on the machine

Result

I set out to put together a docker-compose file that had everything in it that I needed. This is what I came up with.

Most of this is pretty straightforward.

  • A TeamCity container with log and data directories
  • A TeamCity Agent container that comes with dotnet build dependencies.
  • A TeamCity Agent container that comes with npm.
  • An environment variable (npm.installed) that is added to the npm agent. This will help later.
> docker-compose up -d

Setup

Navigate to http://localhost:8111

TeamCity will startup. Follow the directions to configure it using HSQLDB (we’ll use postgres another time) and create a user.

Configure an npm build (I referenced this excellent article).

Now do the following to make sure this build will only run on the correct agent(s):

  • Open your build configuration
  • Click > Edit Configuration Settings
  • Click > Agent Requirements
  • Click > Add New Requirement
  • Require that npm.installed exists as shown below

Now you should be able to run your build.

Hope it helps!

What are your thoughts?

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.