Is there any option for render.yaml, to specify multi-stage docker target?
Hi there,
Are you able to explain a little what you’re trying to achieve here and the use case as we may be able to offer some suggestions
Hi!
I have a Dockerfile with multi stages. Lets say one stage for base install, other for production, and another for development.
When building an image, docker can stop at a specific stage target.
In docker-compose.yaml it can be specified using target
.
build:
context: .
target: prod
This feature is also available at heroku.
build:
docker:
release:
dockerfile: Dockerfile
target: builder
web: Dockerfile
A workaround is to create separate Dockerfiles. And always using the last stage.
Thanks.
Hi, Render supports multi-stage docker builds. So this should work out of the box, here’s more info on Docker with Render in case it’s helpful. Deploy Docker — How to Use Docker | Render
Hi!
Thanks for your answer.
Indeed, render supports multi-stage builds.
What I’m looking for is the option target
which is used to specify a target build stage. Instead of building entire Dockerfile including every stage.
hi @8tentaculos
That’s not something we currently support but I’ve added it as a feature request Support Docker Multistage target in render.yaml | Feature Requests | Render - please make sure to upvote it for later inclusion in the product.
We don’t support multistage targets just yet.
John B
It seems to work, at least for my use case.
FROM robsontenorio/laravel as base
COPY --chown=appuser:appuser . .
FROM base as local
RUN composer global require spatie/phpunit-watcher
CMD ["/usr/local/bin/start"]
FROM base as deploy
RUN chmod a+x .docker/deploy.sh
CMD ["/bin/sh", "-c", ".docker/deploy.sh && /usr/local/bin/start"]
When render starts deploy it runs ONLY first and last stages. Am I wrong?