Skip to content

Commit

Permalink
template for docker bake
Browse files Browse the repository at this point in the history
  • Loading branch information
smerle33 committed Aug 21, 2023
1 parent 0ca6f4a commit 976fb5b
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions resources/io/jenkins/infra/docker/docker-bake.override.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
variable "IMAGE_NAME" {}

variable "REGISTRY" {
default = "docker.io"
}

variable "TAG_NAME" {
default = ""
}

# return the full image name
function "full_image_name" {
params = [tag]
result = notequal("", tag) ? "${REGISTRY}/${IMAGE_NAME}:${tag}" : "${REGISTRY}/${IMAGE_NAME}:latest"
}

target "default" {
dockerfile = "Dockerfile"
context = "."
tags = [
full_image_name("latest"),
full_image_name(TAG_NAME)
]
platforms = "$(PLATFORMS)"
args = {
GIT_COMMIT_REV="$(GIT_COMMIT_REV)",
GIT_SCM_URL="$(GIT_SCM_URL)",
BUILD_DATE="$(BUILD_DATE)",
}
labels = {
"org.opencontainers.image.source"="$(GIT_SCM_URL)",
"org.label-schema.vcs-url"="$(GIT_SCM_URL)",
"org.opencontainers.image.url"="$(SCM_URI)",
"org.label-schema.url"="$(SCM_URI)",
"org.opencontainers.image.revision"="$(GIT_COMMIT_REV)",
"org.label-schema.vcs-ref"="$(GIT_COMMIT_REV)",
"org.opencontainers.image.created"="$(BUILD_DATE)",
"org.label-schema.build-date"="$(BUILD_DATE)",
}
}

0 comments on commit 976fb5b

Please sign in to comment.