![]() When asked for the Type of VCS enter the following data Now create a build configuration for the new project you just defined. You can run the same container on your local dev box, your integration or QA environment or in the production environment to just name a few.Īdd a new project to TC. Once a new Docker images is available on Docker hub it can be pulled from anywhere and instances of it can be run as Docker containers. It is free as long as you only create public repositories. Make sure that you have an account on Docker hub. Now we are ready to configure TC such as that it builds the Docker images with our code and pushes it to the Docker hub. the Dockerfile file which contains instructions on how to build a Docker image for this application.the package.json file which contains the meta data of the project, specifically the information on which node modules the application depends on.the server.js file which contains some logic to self host the application and to define some HTTP GET endpoints.I decided to use those two libraries because a) express JS is relatively big – it consists of and depends on a lot of node modules and b) because I just like the moment library. To demonstrate CI in action we are going to use a very simple node JS application that uses express JS and moments JS. We have just Docker-ized our CI server! Creating a Sample Project Once this is done we are ready to get going. Select the agent and in the following popup click on Authorize. Go to Agents and find the newly added agent under the tab Unauthorized. In TeamCity you have to authorize the agent. The above command runs a Docker image that uses “Docker in Docker” to allow us to build Docker images with this agent (cool eh?). The agent will not be accessible from the outside other than by TC running in the first container. If we want to run more than one agent (remember, up to 3 agents are free) we can run the above command again and just change the name to teamcity-agent-2 and teamcity-agent-3 respectively. Please execute the following command to run an agent in a container called teamcity-agent-1 As you possibly can guess we can do this by running yet another Docker container and linking it with the above TC container. To do something meaningful with TC we need to add at least one build agent. Refer to this documentation on how to use PostgreSQL (also running in a Docker container) as external DB. If you run in production then you should use an external DB. This is OK for this demonstration purpose. By default TC now uses an internal DB to store the configuration data. Which in my case results in the IP address 192.168.99.100. We can easily get the IP address by using docker-machine as follows As mentioned above this VM usually this is called default if you are using the Docker Toolkit. First make sure you get the IP address of your Docker host VM. ![]() Once the Docker container is running we should be able to access TeamCity via browser. TeamCity will be accessible at port 8111. ![]() This should download the Docker image and run it. To do that execute the following command in the Docker Quickstart terminal Running TeamCityįirst we want to run TeamCity in a Docker container on our Docker Host. The VM is configured to be a Docker Host and is thus able to run Docker containers. When you run the Docker Quickstart for the first time it will generate a VM called default running in VirtualBox (which is installed as part of the Toolbox). ![]() If you are not using Linux as the OS of choice install the Docker Toolbox. One of the more interesting usage scenarios is running TC in a Docker container as well as have TC build Docker images as artifacts. It is a wonderful product and is completely free when using up to 3 build agents. We use TC for almost all our project in one or the other form. Please refer to this post for a full table of content. This post is part of the series about Implementing a CI/CD pipeline. CI with TeamCity and Docker – Part 1 22 March, 2016. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |