Team and docker integration

Has anyone used Teamcity artifacts in a new docker build? What I would like to automate is to take the artifacts created by the teamcity team and then create a new docker image with those artifacts. I couldn't find any tutorials on the internet. I saw that Docker can integrate with bitbucket and github, but I wasn't sure if they were the same thing. My base image should be in mono and a few other things. The mono installation is not part of my source, so I was not sure if the github integration would work.

+3


source to share


2 answers


Docker can copy the artifact from a remote url ( https://docs.docker.com/reference/builder/#add ), and TeamCity provides url templates that can be used to download build artifacts from outside of TeamCity ( https: / /confluence.jetbrains.com/display/TCD9/Patterns+For+Accessing+Build+Artifacts ). If you combine the two, you can create a Dockerfile that creates a new image with the given artifact.

Like this:



ADD http://localhost:8111/guestAuth/repository/download/BuildName/latest.lastSuccessful/artifactName.war /opt/wildfly/standalone/deployments/

      

+2


source


I've never worked with a team, but in general it should be possible. First you have to create a base image with everything you need, let's call it "crystal / base".

In your teamcity setup, create your artifact. In the same directory as the artifact, add a Dockerfile with the following:

from crystal/base
ADD artifactFile /var/location_inside_container/artifactFile
CMD ["commandToUserArtifact.sh"]

      



Finally, create a new docker container with

docker build -t crystal/dependent . 

      

+1


source







All Articles