$SOURCE_DIR didn't update when I changed the spec yaml file

I created a spec.yaml file with the line source_dir: src in it. I created my app and pushed it with doctl apps create --spec spec.yaml - all good so far.

After a few minutes the build failed, saying it couldn’t find a file that exists in the repo I pointed the spec to, but not within the src folder. Ok this makes sense: source_dir should just be the whole folder in my case, rather than src.

I tried to repair this by:

  • removing the source_dir line the yaml file
  • Setting it to source_dir: ./ and then source_dir: /

Every change correctly restarted the build when I pushed it to my repo, so:

      branch: main
      deploy_on_push: true

In the spec was working well.


On every rebuild, the $SOURCE_DIR = src remained, and indeed I’d see Using build context /workspace/src in the logs, and get the error again.


I expected one of my attempts to correctly set $SOURCE_DIR to give a build context of just /workspace.

Best Guess

Perhaps the github setup is correctly causing DO to listen to my repo, but not to update the spec itself.

Or there’s just some bad caching happening, and even my attempts to set source_dir in the spec didn’t work because they were invalid


I deleted the app, removed the line from the spec and relaunched it. That worked.

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.

Accepted Answer


I think it’s because this isn’t how you can update your spec. You have to do it with e.g. doctl apps update or some other method; it won’t update based on the target repo.

Try DigitalOcean for free

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

Sign up

Featured on Community

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