Question

How to use Dockerfiles to build an App Platform app

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. 🤓


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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

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