By ReWild
Dear support, is there a way to configure one or more --build-arg values for a Docker-based service in the App Platform?
At the Docker build time, we pass arguments to fine-tune nginx configuration files. We use different Build Arg values for our development, staging, and production environments.
Also, it is not clear whether build_command happens after docker build, or is it actually the way to customize how docker build runs? Could you give some examples of using build_command with Dockerfiles?
Many thanks!
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!
@ReWild 👋
The way to accomplish this today would be to pass in build-time environment variables. If you’re creating envs through the UI, then they’re by default build-and-run-time variables. If creating via raw app spec and doctl, then you can choose one or both using the scope field. We don’t currently support passing --build-args directly, but this is a good idea that we’ll consider adding to the product — your feedback here helps.
An example of an app spec with build-time environment variables might look like this:
name: sample-dockerfile-static
static_sites:
- name: site
github:
repo: digitalocean/sample-dockerfile-static
branch: master
envs:
- key: API_URL
value: https://api.example.com
scope: BUILD_TIME
Hopefully that’s a sufficient workaround in the meantime. Stay tuned to our product release notes for updates on this and other features.
Thanks for using the App Platform, and happy coding!
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.