-
Notifications
You must be signed in to change notification settings - Fork 1
/
docker-bake.hcl
56 lines (52 loc) · 1.36 KB
/
docker-bake.hcl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
variable "CI_REGISTRY_IMAGE" {
default = "registry.gitlab.syncad.com/hive/block_explorer_ui"
}
variable "CI_COMMIT_SHORT_SHA" {}
variable "CI_COMMIT_TAG" {}
variable "TAG" {
default = "latest"
}
variable "BUILD_TIME" {}
variable "GIT_COMMIT_SHA" {}
variable "GIT_CURRENT_BRANCH" {}
variable "GIT_LAST_LOG_MESSAGE" {}
variable "GIT_LAST_COMMITTER" {}
variable "GIT_LAST_COMMIT_DATE" {}
function "notempty" {
params = [variable]
result = notequal("", variable)
}
group "default" {
targets = ["local-build"]
}
target "local-build" {
dockerfile = "Dockerfile"
tags = [
"${CI_REGISTRY_IMAGE}:${TAG}",
notempty(CI_COMMIT_SHORT_SHA) ? "${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHORT_SHA}": "",
notempty(CI_COMMIT_TAG) ? "${CI_REGISTRY_IMAGE}:${CI_COMMIT_TAG}": ""
]
args = {
BUILD_TIME = "${BUILD_TIME}",
GIT_COMMIT_SHA = "${GIT_COMMIT_SHA}",
GIT_CURRENT_BRANCH = "${GIT_CURRENT_BRANCH}",
GIT_LAST_LOG_MESSAGE = "${GIT_LAST_LOG_MESSAGE}",
GIT_LAST_COMMITTER = "${GIT_LAST_COMMITTER}",
GIT_LAST_COMMIT_DATE = "${GIT_LAST_COMMIT_DATE}",
}
output = [
"type=docker"
]
}
target "ci-build" {
inherits = ["local-build"]
cache-from = [
"type=registry,ref=${CI_REGISTRY_IMAGE}/cache:${TAG}"
]
cache-to = [
"type=registry,mode=max,image-manifest=true,ref=${CI_REGISTRY_IMAGE}/cache:${TAG}"
]
output = [
"type=registry"
]
}