Question

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

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.


Submit an answer


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!

Sign In or Sign Up to Answer

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.

Bobby Iliev
Site Moderator
Site Moderator badge
December 2, 2023
Accepted Answer

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

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel