Using docker as build step

Answered

I have a Python application with Pytests (unit tests). The Pytests should be executed and when a test does not succeed, the buildstep should stop and fail. The Python application + tests are in a Github repo. On every build, the code from the repo is pulled and the tests are run. Very simple and that works so far.

I want to put this build step into a docker container but I don't know how to do that. The documentation didn't help me.
Advice would be very welcome.

0
3 comments

It is possible to run individual build steps within a specified Docker container using the Docker Wrapper feature. The Docker Wrapper is supported with the following build runners:

  • Command Line
  • Maven
  • Ant
  • Gradle
  • .NET
  • Python
  • PowerShell

To configure the Docker image you wish to use for the build step, look for the Docker Settings towards the bottom of the build runner configuration page.

0

Hi Eric,

Thanks for the details. Even I am looking to use this feature and would like to understand more about the docker settings. Where does TeamCity look for the specified docker image? Can it be configured to search and use the image from the internal registry?

If you could please provide more details about these settings, would be really useful. Thanks

 

 

0

Where does TeamCity look for the specified docker image? 

TeamCity will pull the image from whatever repository you would like to use, public or private. You do this by including the repository name in the image string (i.e. <respository>/<docker image>). If no repository is specified, the default is docker.io.

Can it be configured to search and use the image from the internal registry?

Of course! If the image already exists on the build agent, it will be used. Unless the tick-box is checked to "Pull image explicitly".

Additionally, it might be worth reading about the Docker Support Build Feature. This feature allows automatically signing in to a Docker registry before the build starts, as well as several other useful features.

0

Please sign in to leave a comment.