Other Top-Level Properties
This document covers other top-level properties in your config.cap.yaml that provide special functionality.
Monorepo Support (monorepo)
If your GitLab project contains multiple applications (a "monorepo"), you need to tell CAP how to handle each application individually. The monorepo flag enables specific behaviors for this use case.
monorepo: true
What it Changes
Setting monorepo: true at the top level of your config.cap.yaml triggers the following automatic configurations:
-
Pipeline Context and Suffix:
- The
pipeline.contextwill automatically be set to your application's slug. This tells the GitLab pipeline to run jobs from the subdirectory containing your application. - The
pipeline.suffixwill also be set to your application's slug. This ensures that job names in the pipeline are unique (e.g.,build:my-app-slug), preventing conflicts with other applications in the same monorepo. - You can still override these values manually in the
pipelineblock if needed.
- The
-
Container Registry Path:
- The path used to store your application's Docker images in the container registry will be modified to include the application's slug. For example, if your project's base registry path is
registry.example.com/my-project, the images for an application with the slugapiwill be pushed toregistry.example.com/my-project/api.
- The path used to store your application's Docker images in the container registry will be modified to include the application's slug. For example, if your project's base registry path is
Example
Consider an application with the slug my-api in a monorepo.
config.cap.yaml:
monorepo: true
type: laravel
# ... other configs
Resulting Behavior:
- The pipeline will run as if you had set
pipeline.context: "my-api"andpipeline.suffix: "my-api". - When a Docker image is built, it will be tagged and pushed to a path like
registry.example.com/your-project/my-api.