Root directory configuration
The root directory setting allows you to specify a subdirectory within a repository. This is useful when frontend and backend services, reside in different folders within the same repository.
Overview
The Root Directory setting allows you to specify a subdirectory within a repository for deployment. This is useful for monorepositories where multiple applications, such as frontend and backend services, reside in different folders within the same repository.
By default, the root directory is set to the root of the GitHub/GitLab repository. If your application is inside a subfolder, you must provide a relative path to that folder.
How it works
The start command and build command are executed inside the directory specified in the root directory setting.
If no root directory is set, commands run at the repository root.
This setting enables deploying separate services (e.g., frontend & backend) from the same repository.
Example repository structure
Consider a monorepository with the following structure:
Setting the root directory
To deploy the frontend, set the root directory to:
To deploy the backend, set the root directory to:
Example usage
Deploying a frontend (React)
If the frontend is in frontend/
, set:
Root directory →
frontend
Build command →
npm install && npm run build
Start command →
npm start
Deploying a backend (Python Flask)
If the backend is in backend/
, set:
Root directory →
backend
Build command →
pip install -r requirements.txt
Start command →
python main.py
Conclusion
Using the Root Directory setting allows flexible deployments from monorepositories, ensuring commands run in the correct directory without affecting other parts of the repository.
Last updated