Hi @switchtrue,
This is technically possible, however, at present, you would need separate Waypoint.hcl
files due to the way that resources are isolated in the workspace.
For example, your dev
Workspace would use the following Waypoint configuration which would build a Docker image before deploying it.
project = "wpmini"
app "wpmini" {
labels = {
"service" = "wpmini",
"env" = "dev"
}
build {
use "pack" {}
registry {
use "docker" {
image = "docker-registry.container.shipyard.run:5000/wpmini"
tag = "latest"
}
}
}
deploy {
use "docker" {}
}
}
This would be deployed with the commands:
waypoint init --workspace dev #only needed once
waypoint up --workspace dev
For the test or production environments, as you state you want to re-use the artifacts created in the dev workspace. At present, there is no automatic way of managing this in waypoint but you can achieve the same thing by using a slightly different Waypoint file.
In a test or release Waypoint file, you can replace the docker
plugin which builds a container with the docker-pull
plugin. This would re-use the image created in the dev
workspace.
project = "wpmini"
app "wpmini" {
labels = {
"service" = "wpmini",
"env" = "dev"
}
build {
use "docker-pull" {
image = "docker-registry.container.shipyard.run:5000/wpmini"
tag = "latest"
}
}
deploy {
use "docker" {}
}
}
Again you use the workspace command when running init
and up
, this time targeting the prod
workspace.
waypoint init --workspace prod #only needed once
waypoint up --workspace prod
This run would re-use the image built in a previous stage and deploy it to the production environment.
Different environments are something that we are going to be building on with subsequent releases of Waypoint.
Kind regards,
Nic