You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: apps/docs/content/zerops-yaml/specification.mdx
+43Lines changed: 43 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -52,6 +52,49 @@ zerops:
52
52
53
53
Each service configuration requires `build` and `run` sections. An optional `deploy` section can be added for readiness checks.
54
54
55
+
## Service Inheritance
56
+
57
+
### extends <Badge type="optional" />
58
+
59
+
The `extends` key allows you to inherit configuration from another service defined in the same `zerops.yaml` file. This is useful for creating environment-specific configurations while maintaining a common base.
60
+
61
+
```yaml
62
+
zerops:
63
+
- setup: base
64
+
build:
65
+
buildCommands:
66
+
- echo "hello"
67
+
deployFiles: ./
68
+
run:
69
+
start: server run
70
+
71
+
- setup: prod
72
+
extends: base
73
+
run:
74
+
crontab:
75
+
- command: xyz
76
+
allContainers: false
77
+
timing: "* * * * *"
78
+
79
+
- setup: dev
80
+
extends: base
81
+
run:
82
+
crontab:
83
+
- command: different command
84
+
allContainers: false
85
+
timing: "* * * * *"
86
+
```
87
+
88
+
When using `extends`:
89
+
- The `extends` value must refer to another service's `setup` value in the same file
90
+
- The child service inherits all configuration from the base service
91
+
- Configuration is merged at the section level (`build`, `run`, `deploy`)
92
+
- You can override specific sections by redefining them
93
+
94
+
:::tip
95
+
Create a base service with common configuration and extend it for environment-specific services to keep your `zerops.yaml` file DRY (Don't Repeat Yourself).
0 commit comments