Hi,
Documentation about post-processors (docker-import, docker-push) lacks some real life samples, and I can’t find my answers anywhere on the web.
I just have one question: given the following basic sample (HCL), is it possible to use the docker-push post processor to publish the produced image to an Azure Container Registry?
# Settings variables
variable "acr_url" {
type = string
default = "<account>.azurecr.io"
}
variable "acr_login" {
type = string
default = "<account>"
}
variable "acr_password" {
type = string
default = "mySuperDuperPassword"
sensitive = true
}
# Set docker source
source "docker" "ubuntu" {
image = "ubuntu:20.04"
pull = true
commit = true
}
# Build steps
build {
name = "agent"
source "sources.docker.ubuntu" {
changes = [
"ENV AGENT_OS linux"
]
}
post-processor "docker-tag" {
repository = "alm/agent/ubuntu"
tags = [ "latest" ]
}
}
I tried to add this post-processor without success.
post-processor "docker-push" {
login = true
login_server = "${var.acr_url}"
login_username = "${var.acr_login}"
login_password = "${var.acr_password}"
tags = [ "latest" ]
}
I also tried to push from the HCL file to Docker Hub (changing the repo name which does not allow ‘/’), without success: I can only make it work from the command line.
Thanks for any advice.