Environment deltas
Config
- stack.cue
- builder.cue
package main
import (
"stakpak.dev/devx/v1"
"stakpak.dev/devx/v1/traits"
)
stack: v1.#Stack & {
components: {
cowsay: {
traits.#Workload
containers: default: {
image: "docker/whalesay"
command: ["cowsay"]
}
}
}
}
builders: {
env1: components: cowsay: containers: default: args: ["Hello DEV!"]
env2: components: cowsay: containers: default: args: ["Hello PROD!"]
}
package main
import (
"stakpak.dev/devx/v2alpha1"
"stakpak.dev/devx/v2alpha1/environments"
)
builders: v2alpha1.#Environments & {
env1: environments.#Compose & {
drivers: compose: output: file: "docker-compose-env1.yml"
}
env2: environments.#Compose & {
drivers: compose: output: file: "docker-compose-env2.yml"
}
}
Build
devx build env1
devx build env2
Result
- Dev
- Prod
docker-compose-env1.yml
version: "3"
volumes: {}
services:
cowsay:
image: docker/whalesay
environment: {}
depends_on: []
command:
- cowsay
- Hello DEV!
restart: always
volumes: []
docker-compose-env2.yml
version: "3"
volumes: {}
services:
cowsay:
image: docker/whalesay
environment: {}
depends_on: []
command:
- cowsay
- Hello PROD!
restart: always
volumes: []