Report this

What is the reason for this report?

How to use Dockerfiles to build an App Platform app

Posted on March 31, 2022

Because App Platform doesn’t allow me to run composer config before composer install is executed, I have been told that I should use the other method of building an app: Dockerfiles (https://docs.digitalocean.com/products/app-platform/languages-frameworks/php/)

The problem is…there is no documentation. Nevermind that DO boasts about “robust documentation” and has had App Platform in the wild for well over a year. 😒

Anyway, I’d really like to get this to work, but I have no idea where to begin or what to do. The only thing I know is that I need a dockerfile.

DO support pointed me to this community, but my searches haven’t yielded anything valuable…perhaps because I’m not entirely sure what I should be searching for.

Thanks in advance for any help you might be able to provide. 🤓



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, I’m attaching the App Spec Reference here if you haven’t already seen it: https://docs.digitalocean.com/products/app-platform/references/app-specification-reference/

Under the component type that you’re interested in building (service, worker, job… etc) you can find dockerfile_path

You would then put the Dockerfile path relative to the root directory of the repository in that field.

Here is an example of a dockerfile based app: https://github.com/digitalocean/sample-dockerfile

Here is an example of the app spec for the above example: https://github.com/digitalocean/sample-dockerfile/blob/main/.do/app.yaml

To deploy that, you would use doctl with the following: doctl apps create --spec /path/to/app/spec

Alternatively you can use a registry such as Dockerhub or DigitalOcean Container registry. Here is a link to documentation for that: https://docs.digitalocean.com/products/app-platform/how-to/deploy-from-container-images/

Happy Coding! Greg

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.