Custom docker command (build tools) - Pants

Hi everyone,

we are considering to migrate our Django app to Qovery. It is located in a monorepo where we use Pants as the build tool. As far as I have understood, one option to deploy an app on Qovery is using a Dockerfile, which we do.

However, we use Pants to build that Dockerfile as it has certain dependencies as defined by pants. Can we use this to deploy with Qovery? Usually, we would publish it to a container repository and then use it for deployment.

Looking forward to learn more about Qovery! :slightly_smiling_face:

Hi @ptrhck , welcome and thanks for considering using Qovery.

Indeed, Qovery supports Dockerfile (recommended) and Buildpacks to build a final container image.

Just to be sure and clarify. Do you have a Dockerfile or do you want to build a container image with Pants and deploy it via Qovery?

Thank you

I do have a Dockerfile from which I would like to build an image with Pants.

Can you show me your Dockerfile?

We are still in the process of adopting Pants, so I cannot share any final Dockerfile. But it will be similiar to the example:

FROM python:3.8
ENTRYPOINT ["/bin/helloworld"]
COPY src/docker/hw/msg.txt /var/msg
COPY src.python.hw/bin.pex /bin/helloworld

Here the dependency inference does the magic. This is a very basic inference, but I can add other dependencies to this Docker image target, e.g. building another Docker image that serves as the base image for my application image. Did you get the idea?

As a note: The src.python.hw/bin.pex is not a file that you commit but will be packaged in CI. Due the Pants dependency inference, as the Docker target depends on the Pex binary target.

Ok, I get the idea (I didn’t know about Pants). And when you run docker build -f Dockerfile -t python:pants . locally the container is built correctly?

And what about docker run -t python:pants?

No, this is not the way to go. I will try to illustrate on a Django example. I define my goals and targets in a django/BUILD file as follows:

    dependencies = [":django_manage", ":custom_base_image"],



The django_image has two dependencies, namely a base image and the source artifact, which are required in the Dockerfile which looks as follows:

FROM my-custom-base-image
COPY src.python.hw/bin.pex /bin/helloworld
ENTRYPOINT ["/bin/helloworld"]

Now I can run ./pants package django:django_image (do not get confused by the django prefix, this is just the folder in the monorepo and I run the pants command from the root of the monorepo) which builds the Docker image (see source="Dockerfile" in the first target) and makes sure through the dependencies array that the base image and the Pex binary are build/packaged beforehand. The result is a Docker image with the tag my-django-image which I can run the way I want, e.g. with docker run my-django-image or push it to a registry, e.g. AWS ECR and and use it for an AWS ECS task.

I hope this got clear now. Looking forward to hear your thoughts!

Thank you for the great explanation @ptrhck .

From what I understand you will need to be able to deploy right from your container registry with Pants. Because your final image is actually based on FROM my-custom-base-image which is not available on a public registry right?

We started working on this feature but we had to pause it at the moment. I can see with my team when we’ll deliver it.

Side note: You can subscribe to our public roadmap and vote for the feature you need.

Yes, the final image is based on FROM my-custom-base-image but it does not have to be on a registry. The illustrated workflow is similiar to:

  1. docker build -t my-custom-base-image -f base.Dockerfile
  2. docker build -t my-django-image -f Dockerfile (the base image is present in the current environment and does not need to be pulled from a regsitry)

That is why I was asking if one can provide a custom docker build command. If Qovery just runs docker build on the provided Dockerfile, that would obviously not work. Is there any resource to understand what Qovery is doing with that Dockerfile?

Which feature are you referring to? That private registry images can be pulled?

Unfortunately, it is not possible.

Here is the code

Using your own private container registry will do the job for what you need to do.

Thank you for all the information! Would really appreciate to get an ETA for this feature as this is a real block to migrate to Qovery unfortunately. Cheers!

Any update on when the private registry feature will be shipped?

Hello @ptrhck,

We are currently working on the private registry/container feature at the moment !
It should be available mid/end August :slight_smile:

Out of curiosity, which registry are you using ?


Great to hear, thanks! We currently use AWS ECR. Can I somehow subscribe to release process of this feature?

Perfect for ECR :slight_smile:

Sadly, we don’t have any means to subscribe to specific features.
But you can subscribe to qovery newlestter (email) or follow us on linkedin in order to receive new features released.

Hi back @ptrhck

After discussion with the product team, you can look at our roadmap where we update the status for the container feature.