I am building a Laravel App, which runs great on the App Platform. It has a service, two workers (schedule:work and queue:work) and a pre-deploy job (migrate). They use the same code, env variables, etc., but it looks like they are building one after another, wasting tons of time. How can I build one image (maybe as a pre-deploy job) and use it in the service, workers and pre-deploy job containers?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
We do support build reuse between components as long as we can determine there are no differences in the spec that would affect the build phase.
For example, you can modify the
run_commandbetween two different components and it will share the build, but if the
commit_hashwas different, then we would have to issue a new build for each component.
Procfileis also supported and you can create a file similar to the following in order to specify a default
run_commandfor your component:
In your case, it sounds like something is causing us to detect a difference in the build key for reusing builds between your components. Is it possible for you to provide a sanitized version of your app spec for us to view? Alternatively, you can reach out to support with more detailed information and we can take a look at your specific application.
In general though, you should be able to achieve your approach by just changing the
run_commandfor each of your components and leaving the rest of the configuration between the components the same.
Btw, it takes almost 20 minutes for a deployment, because it builds tons of images. With heroku I could simply use a Procfile with a few lines in there. Is there no way to achieve the same?
Want to learn more? Join the DigitalOcean Community!
Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.
Sign up now