Report this

What is the reason for this report?

How to force build in app deployments

Posted on November 17, 2020

I have a Next.js app deployed as a web service on App Platform, because I want to take advantage of both its SSR and SSG capabilities. I’ve connected it to my CMS, which sends a webhook to Digital Ocean to trigger a redeploy when changes require a rebuild of the app.

However, DO will skip the build for any deploy in which the code doesn’t change. My question is, how can I force DO to rebuild on every deploy?

Thanks!

Justin



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.

👋🏼 @ilonews

It’s possible to force build the app from source even if a previous build can be reused, however right now it is only available via doctl and the API. The web control panel should support it soon.

With doctl, as of the v1.52.0 release, you can pass the --force-rebuild option to the doctl apps create-deployment command.

If you are using the API, the POST /v2/apps/<app_id>/deployments route accepts a JSON document for the body. You can set the force_build option in it like so:

curl \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer TOKEN" \
    "https://api.digitalocean.com/v2/apps/<app_id>/deployments" \
    -XPOST \
    -d '{"force_build": true}'

With the new DO serverless functions you could receive the Strapi webhook request and then trigger the deployment.

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.