Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

conan-docker-runner added #267

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

davidsanfal
Copy link
Contributor

No description provided.

@davidsanfal davidsanfal requested review from jcar87 and czoido May 28, 2024 13:36
@uilianries
Copy link
Member

docker-nuts

---
layout: post
comments: false
title: "Introducing the Conan Docker runners: Running Conan remotelly"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that Running Conan remotelly it's a bit confusing name...
What about something similar to: Running Conan Seamlessly in Docker Containers ?

Comment on lines 5 to 6
meta_title: "How to run Conan inside a Docker container"
description: "Runing Conan inside a Docker container"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would also add something like seamless or transparent here

---
layout: post
comments: false
title: "Introducing the Conan Docker runners: Running Conan remotelly"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
title: "Introducing the Conan Docker runners: Running Conan remotelly"
title: "Introducing the Conan Docker runners: Running Conan remotely"

comments: false
title: "Introducing the Conan Docker runners: Running Conan remotelly"
meta_title: "How to run Conan inside a Docker container"
description: "Runing Conan inside a Docker container"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
description: "Runing Conan inside a Docker container"
description: "Running Conan inside a Docker container"


**Fully integrated with Conan**

When you define a docker runner inside your host profile you are saying that you want to build your code using conan inside a docker image. Conan will try to build or reuse a docker image and run a conan create conan inside it. After that, conan copy the cache information from your docker container inside your host cache, obtainig the same result like an standard conan create.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
When you define a docker runner inside your host profile you are saying that you want to build your code using conan inside a docker image. Conan will try to build or reuse a docker image and run a conan create conan inside it. After that, conan copy the cache information from your docker container inside your host cache, obtainig the same result like an standard conan create.
When you define a docker runner inside your host profile you are saying that you want to build your code using conan inside a docker image. Conan will try to build or reuse a docker image and run a conan create conan inside it. After that, conan copy the cache information from your docker container inside your host cache, obtaining the same result like an standard conan create.

Comment on lines +9 to +10
Runners provide a seamless method to execute Conan on remote build environments like Docker ones, directly from your local setup by simply configuring your host profile.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about some introduction, summarizing the problem, that this was a very requested feature, and then we released that in some Conan version...


Runners provide a seamless method to execute Conan on remote build environments like Docker ones, directly from your local setup by simply configuring your host profile.

## Main features
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we better remove this title and make the main features part of the introduction?


## Main features

**Fully integrated with Conan**
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the titles I would try to use more compact titles, like this for example:

Suggested change
**Fully integrated with Conan**
**Seamless integration**


When you define a docker runner inside your host profile you are saying that you want to build your code using conan inside a docker image. Conan will try to build or reuse a docker image and run a conan create conan inside it. After that, conan copy the cache information from your docker container inside your host cache, obtainig the same result like an standard conan create.

**Use the image you want or create one**
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would also make this shorter, maybe something like: "Customizable Images" ?


Finally, if you want to use a pre-existing image or you want to give a specific name to the one you are compiling, you have the variable `image` where to define it.

**Full control over the management of your host chache**
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something like Different cache modes ?


In all cases the result of the `conan create` command will be exactly the same and will end up stored in the local host cache, what changes is the starting point of the container cache and the way the result of the command ends up in the local host cache.

**Control over the lifecycle of your containers**
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
**Control over the lifecycle of your containers**
**Container Lifecycle control**

- `suffix`: *docker* by default. Define the suffix name used to create your container *conan-runner-*`suffix`.
- `remove`: *false* by default. If you want to delete you container after an execution set it to *true*.

**Host profile example**
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should not be at the same level than the main features?

remove=true
```

## Do you need more control when running or building your containers? The configfile runner is the answer.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can leave this as a bonus after going through the most basic use example?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or we can even omit this in the blogpost and just add a link to the documentation, I think the blogpost should put users to try the feature as soon in the read process as we can.


## Do you need more control when running or building your containers? The configfile runner is the answer.

If you need more control over the build and execution of the container, you can define more parameters inside a configfile yaml.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
If you need more control over the build and execution of the container, you can define more parameters inside a configfile yaml.
If you need more control over the build and execution of the container, you can define more parameters inside the _configfile.yaml_ file.

$ tree
.
├── Dockerfile
├── configfile
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
├── configfile
├── configfile.yaml

RUN pip install conan
```

Now, we need to write the `configfile` to defile the `BASE_IMAGE` variable defined inside the Dockerfile.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Now, we need to write the `configfile` to defile the `BASE_IMAGE` variable defined inside the Dockerfile.
Now, we need to write the `configfile` to define the `BASE_IMAGE` variable defined inside the Dockerfile.

remove=false
```

## Lets try it!
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the post would benefit if you can clone code with the configuration files from the examples2 repo

Comment on lines 137 to 140
type=docker
configfile=</my/runner/folder>/configfile
cache=copy
remove=false
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be nice to explain a bit further this section, to reinforce some concepts from the introduction, also for example to justify why here we want to use cache=copy, etc.

REPOSITORY TAG IMAGE ID CREATED SIZE
```

Now, lets clone and build zlib from conan-center-index and create it using our new runner definition.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can explain a bit the process that is going to happen here

Comment on lines 501 to 513
If we run the ``conan create`` command again we will see how Conan reuses the previous container because we have set ``remove=False``.

```bash
$ conan create ./conan-center-index/recipes/zlib/all --version 1.3.1 -pr:h </my/runner/folder>/docker_example_host -pr:b </my/runner/folder>/docker_example_build

...

┌───────────────────────────────┐
| Starting the docker container |
└───────────────────────────────┘

...
```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this ending is a bit abrupt? What about some conclusions or some goodbye message?

Copy link
Member

@memsharded memsharded left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd probably wouldn't use recipes from conan-center-index but a simple "hello world" one created with conan new:

  • As the hooks are not in the docker, the revision created there might be different to the revision created in the host, and users will be confused (binaries that they created locally will not be listed, as they belong to an older revision)
  • The paths to the recipe, the versions, etc, are in general more complicated command line. With a conan new template, it becomes easier.

Comment on lines 58 to 59
os=Linux
[runner]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
os=Linux
[runner]
os=Linux
[runner]

Comment on lines 92 to 93
os=Linux
[runner]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
os=Linux
[runner]
os=Linux
[runner]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants