Multistage Dockerfile Caching

I see that Aptible has introduced support for multistage Dockerfiles recently, which is great (Build Docker images faster and increase DevOps productivity with multi-stage builds).

I’m wondering you could provide guidance related to ensuring that the stages that aren’t the last stage are going to be cached appropriately? See this article for an explanation of the problem: Multi-stage builds #3: Speeding up your builds.

Currently, the Aptible platform builds multi-stage Dockerfiles in the same way as single-stage Dockerfiles when using Dockerfile Deployment so it’s not possible to cache intermediate stages with multiple docker build commands as described in the article you shared.

In order to do something like that, you’d need to build the image yourself and use Direct Docker Image Deployment. This will give you full control over the build process including caching, Dockerfile ARGs, and docker build arguments.

If you’d like to see this feature added to the platform, you can submit feedback to the product team from the public roadmap.