Report this

What is the reason for this report?

How to add a file from space to my app in App platform?

Posted on December 1, 2023
Ferd

By Ferd

I have a file in space that I would like to add during building of my app deployed in App Platform.

My app is connected to github, but I don’t want to use github in this case. How it is done in app spec for example?

Thank you.



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.

Hello Ferd,

To include a file from DigitalOcean Spaces in the build process of your app on the DigitalOcean App Platform, you’ll need to configure your app to fetch the file from Spaces during the build phase. Here’s a general approach to achieve this:

  1. Make sure that your file is accessible:

    • If the file in Spaces is private, you may need to generate a pre-signed URL that allows temporary access to the file. This can be done through the DigitalOcean Spaces dashboard or using an S3-compatible tool.
    • If the file is public, you can directly use its URL.
  2. Modify Your Build Command:

    • Update your build process to include a curl command to download the file from Spaces.

    • For example:

      curl -o [local-path-to-save-file] '[file-url-in-spaces]'
      
    • Replace [local-path-to-save-file] with the path and filename where you want to save the file in your build environment. Replace [file-url-in-spaces] with the actual URL of your file in Spaces.

  3. Include the Command in Your App Spec or Build Script:

    • If you’re using an app specification (app spec) YAML file, include this curl command in the build_command or run_command section.
    • If you’re configuring your build process through another method (like a Dockerfile or a script), include the curl command in the appropriate place.

Make sure to replace the placeholders with your specific file’s details.

Hope that this helps and let me know how it goes!

Best,

Bobby

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.