EDIT: my bad, it turns out I misunderstood the question!
I'm not an AWS guru, but to deploy to a Kubernetes cluster, I believe you would just need an extra step calling kubectl apply -f your-service.yml
or something like that.
It is not possible out-of-the-box to push to private registries via the docker
(now kaniko
) top-level DSL, but this DSL is rather legacy.
Instead, use the dockerBuildPush DSL in a host
step (instead of a docker
/kaniko
step).
One way to login to the private registry is to provide the credentials as secrets to the job (add the secrets in the project settings first) and do a docker login
command in a shellScript
block before dockerBuildPush
:
job("Build Image and save to registry") {
startOn {
gitPush {
anyBranchMatching {
+"main"
}
}
}
host {
env["REGISTRY_USER"] = "{{ project:registry_user }}"
env["REGISTRY_PASS"] = "{{ project:registry_pass }}"
env["REGISTRY_URL"] = "{{ project:registry_url }}"
shellScript {
content = "docker login -u \$REGISTRY_USER -p \$REGISTRY_PASS \$REGISTRY_URL"
}
dockerBuildPush {
tags {
+"<my-private>.registry.jetbrains.space/p/repo/repo/image:latest"
}
}
}
}
As of June 2023, you can now also use the dockerRegistryConnections DSL (but it's not available in the Free plan). In your project settings, you need to go to Docker Registry Connections
tab, and add credentials there, and give them a key for reference, e.g. "my-private-registry"
. Then you can simply add a dockerRegistryConnections
block with a reference to your key, and the worker will login before the step and logout after the step, without the need for manipulating secrets:
job("Build Image and save to registry") {
startOn {
gitPush {
anyBranchMatching {
+"main"
}
}
}
host {
dockerRegistryConnections {
+"my-private-registry"
}
dockerBuildPush {
tags {
+"<my-private>.registry.jetbrains.space/p/repo/repo/image:latest"
}
}
}
}
See the documentation for more info.