By thekonz
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!
Accepted Answer
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_command
between two different components and it will share the build, but if the build_command
or commit_hash
was different, then we would have to issue a new build for each component.
Procfile
is also supported and you can create a file similar to the following in order to specify a default run_command
for your component:
web: bin/sample-golang
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_command
for 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?
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.