How to setup Conan Repository on Artifactory via Docker

For C++ developers package/library management is not simple as in other many languages. However, there are some tools that make this process less painful. One of those tools is Conan which is a portable package manager, intended for C and C++ developers, but it is able to manage builds from source, dependencies, and precompiled binaries for any language. Conan is free and opensource, works on all mainstream operating systems including Windows, Linux, macOS, FreeBSD, etc.

Image for post
Image for post
https://conan.io/

Nonetheless in this post, I want to go over the platform “Artifactory” from JFrog where you can deploy your Conan packages. Basically, Artifactory is a universal repository manager supports lots of package type such as docker registry, npm, deb packages, and much more. On the contrary, to Conan, the Artifactory is a commercial tool.

Image for post
Image for post

Luckily JFrog provides a community version for C/C++ developers where you can deploy your Conan packages without any payment.

Let’s start to install and setup Artifactory on your machine. Sure you can install on your machine as service but I will use docker without installing. We are living in Cloud/Container time, everything should work in a container as well :)

So will use official documentation of Artifactory and perform described instruction. Moving on step by step:

  1. Step: Create a home directory and system.yml file for Artifactory.

Now we’ve created the Artifactory home directory and gave the required permission for the home path. So let’s run the docker container.

2. Pull the docker image and run the container

After pulling the docker image we ran the container. Browse localhost:8082 on your browser then you should see the following screen:

Image for post
Image for post

Or you might see the login page in case the container gets ready fast. The default user and password

admin:password

3. Step: Create repository

Enter the username and password above and the next screen will be resetting admin default password wizard, go simply through the steps. After you change the default password successfully you might create Conan repository now or later.

Image for post
Image for post

Hence it’s the community version, you’re able to create either Conan or Generic repository type, but we want to use for Conan packages. Click next then the following screen should appear:

Image for post
Image for post

Save it then you are ready to use. Before we deploy a simple Conan package to our repo “medium-conan” on Artifactory, it might be useful to see Admin-Panel :

Image for post
Image for post

From admin panel, you can set your security parameters, create use for developer to deploy packages or monitoring all repository, etc.

4. Step: Deploy Conan packages:

Now on we are ready to deploy our Conan package. I’ve already created some Conan packages which I will deploy to Artifactory. Some substeps:

4.1. Add repository to your remote repository on your local machine by the following command:

conan remote add <any_name> http://<localhost:Port>/artifactory/api/conan/<repo-name>

If you added successfully then ready to deploy. See my screen:

Image for post
Image for post

Then enter the username and password. That’s it!

Let’s move on Artifactory to monitor it:

Image for post
Image for post

The packages are about 6 KB and consist of 12 files etc.

Computer Science And DevOps things :)

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store