-
-
Couldn't load subscription status.
- Fork 6
Deploy Settings
The deployment configuration file must be placed in the root/base directory of your repository and named one of the following:
.doco-cd.yaml.doco-cd.yml
The docker compose deployment can be configured inside the deployment configuration file using the following settings:
Note
Settings without a default value are required.
| Key | Type | Description | Default value |
|---|---|---|---|
name |
string | Name of the deployed stack / project / application. | |
reference |
string | Git reference to deploy from, must be either a branch (e.g. main or refs/heads/main) or tag (e.g. v1.0.0. or refs/tags/v1.0.0) |
- Polling: the reference from the Poll Config - Webhooks: the reference of the webhook payload |
repository_url |
string | HTTP clone URL of another repository that contains the docker compose files to be deployed. If specified, the deployment runs from there. Also set reference to specify the branch. |
(Ignored when not specified) |
working_dir |
string | The working directory for the deployment. |
. (Root/base directory of cloned repository) |
compose_files |
array of strings | List of docker-compose and overwrite files to use (in descending order, first file gets read first and following files overwrite previous configs). Unknown/Non-existing files get skipped. | [compose.yaml, compose.yml, docker-compose.yml, docker-compose.yaml] |
profiles |
array of strings | List of compose profiles to use for the deployment, e.g., ["prod", "debug"]. | [] |
webhook_filter |
string | A regular expression to whitelist deployment triggers based on the webhook event payload. See the Webhook Filter Section below. | |
remove_orphans |
boolean | Remove/Prune containers/services that are not (or no longer) defined in the Compose file. | true |
force_recreate |
boolean | Forces the recreation/redeployment of containers even if the configuration has not changed. | false |
force_image_pull |
boolean | Always pulls the latest version of the image tags you've specified if a newer version is available. | false |
timeout |
number | The time in seconds to wait for the deployment to finish before timing out. | 180 |
destroy |
boolean | ( |
false |
When using the default values, most settings can be omitted.
name: some-project # name of the deployed stack/projectname: some-project # name of the deployed stack/project
reference: other-branch # use this branch for deployment
working_dir: myapp/deployment # move to this sub-directory for deployment
compose_files: # List of docker compose files to use in descending order
- prod.compose.yml
- service-overwrite.yml
profiles:
- debug # Deploys debug services in addition to the core/main services (that have no profiles)When deploying your docker compose stack from a different repository, the repository_url setting must be specified.
The reference and working_dir are used in this case to specify the branch/tag and sub-directory of the other repository that contains the docker compose files.
name: some-project # name of the deployed stack/project
repository_url: https://github.com/my-org/myapp.git # use this repository for deployment
reference: other-branch # use this branch in the my-org/myapp repository for deployment
working_dir: myapp/docker # move to this sub-directory in the my-org/myapp repository for deploymentThe following settings can be used to build docker images during a deployment (Like docker compose build or docker compose up --build).
Specify all build-settings in a nested build_opts object (See example) in the deployment configuration file.
| Key | Type | Description | Default value |
|---|---|---|---|
force_image_pull |
boolean | Always attempt to pull the latest version of the image | false |
quiet |
boolean | Suppress the build output in the logs | false |
args |
map of strings | A map of build-time arguments to pass to the build process | null |
no_cache |
boolean | Disables the use of the cache when building images | false |
name: some-project
build_opts:
force_image_pull: true
args:
BUILD_DATE: 2021-01-01
VCS_REF: 123456
no_cache: trueThe following settings can be used to configure further how the deployed compose stack/project will be removed (if destroy is set to true):
Specify all destroy-settings in a nested destroy_opts object (See example) in the deployment configuration file.
| Key | Type | Description | Default value |
|---|---|---|---|
remove_volumes |
boolean | Remove all volumes used by the deployment (always true in docker swarm mode) |
true |
remove_images |
boolean | Remove all images used by the deployment (currently not supported in docker swarm mode) | true |
remove_dir |
boolean | Remove the cloned repository in the data directory after the deployment is removed (Setting this to false is useful e.g. when you use bind mounts and want to keep the data) |
true |
name: some-project
destroy: true
destroy_opts:
remove_volumes: true
remove_images: false
remove_dir: falseSet webhook_filter to a regular expression to whitelist deployment triggers based on the webhook event payload.
Depending on the event, the reference in a webhook payload has a pattern of
-
refs/heads/<branch>for branches -
refs/tags/<tag>for tags - Or no reference at all if the event is not associated with a tag or a branch event
Note
If the reference setting value is unset/empty, the reference of the webhook payload will be used for deployments.
If reference is set, deployments for all events that pass the webhook_filter, will always run from that branch or tag.
You can specify the filter explicitly or in a loose form. Explicit regular expressions are recommended.
See Go Regular Expressions for more information on the syntax.
- Only on events on the main branch:
^refs/heads/main$ - Only on tag events with semantic versioning:
^refs/tags/v[0-9]+\.[0-9]+\.[0-9]+$)
- Must contain
stablesomewhere in the reference:stable
Warning
Loose expressions can allow references that might not be wanted.
E.g. refs/heads/main (without ^ and $) also allows refs/heads/main-something
Multiple service deployments can be configured in a single deployment config file by specifying multiple YAML documents (separated by ---).
name: app1
working_dir: app1
---
name: app2
working_dir: app2
timeout: 600
---
name: app3
working_dir: app3
compose_files:
- custom.ymlAll docker compose files are located in the same base directory.
name: gitea
compose_files:
- gitea.yml
---
name: paperless-ngx
compose_files:
- paperless.yml
- paperless-overwrite.ymlWhen docker compose files are located in sub-directories.
name: gitea
working_dir: gitea
---
name: paperless-ngx
working_dir: paperless-ngx
compose_files:
- docker-compose.yml
- docker-compose.overwrite.ymlFurther examples can be found in the examples section below.
You can specify multiple deployment target configurations in a mono-repo style setup using the application's dynamic webhook path. This allows you to deploy to different targets/locations from a single repository. See Webhook Listener with custom Target for more information.