I have a monorepo, which has 2 directories for each project. Now, they have their own Dockerfiles (so bot/Dockerfile
and api/Dockerfile
), and I would like DigitalOcean to build using the relevant dockerfile, so if I have 1 app called tags-api
, it will use api/Dockerfile
to build, and vice versa for bot.
Now my question is, how do I do so? Since currently it just checks for ./Dockerfile
, which, in this case doesn’t exist.
Alternatively, could it possibly use my docker-compose file? I have a ./docker-compose.yaml
file but I couldn’t find an option where I could use compose instead of Docker.
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!
Accepted Answer
Hi there,
You should be able to use the dockerfile_path
directive in your App Spec definition. The path to the Dockerfile is relative to the root of your repo. If set, it will be used to build this component. Here is an example:
name: sample-dockerfile
services:
- name: web
git:
repo_clone_url: https://github.com/digitalocean/sample-dockerfile.git
branch: main
dockerfile_path: Dockerfile
There is no need to use docker-compose
you would just have to define all of your services in your app spec file as separate components instead.
Here is a reference to the documentation that might be helpful as well:
https://docs.digitalocean.com/products/app-platform/reference/dockerfile/
Let me know how it goes!
Best,
Bobby
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.