-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-bake.hcl
More file actions
205 lines (186 loc) · 6.12 KB
/
docker-bake.hcl
File metadata and controls
205 lines (186 loc) · 6.12 KB
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
# docker-bake.hcl - Parallel Docker builds for BPP
#
# Obraz dbservera (iplweb/bpp_dbserver) jest budowany w osobnym repo:
# https://github.com/iplweb/bpp-dbserver
#
# Usage:
# make build # Local parallel build (default)
# make build-base # Build only base image
# docker buildx bake --print # Show build plan without executing
#
# Variables can be overridden via environment or --set flag:
# DOCKER_VERSION=202601.1234 make build
# docker buildx bake --set PUSH=true
variable "DOCKER_VERSION" {
default = "latest"
}
variable "PLATFORM" {
default = "linux/amd64"
}
variable "PUSH" {
default = false
}
variable "GIT_SHA" {
default = "unknown"
}
# Rozróżnienie release vs developer build. Master release -> "release"
# (stopka pokazuje tylko numer wersji); PR/feature/lokalne -> "dev"
# (stopka dokleja `(<image_tag>, commit XXXXXXX)` po wersji, dla łatwego
# namierzenia którego commitu/buildu dotyczy obraz, gdy tag jest
# niejednoznaczny).
variable "BPP_BUILD_FLAVOR" {
default = "dev"
}
# Kanoniczny tag obrazu (np. "119-merge", nazwa brancha, "202604.1364"
# dla mastera). Workflow przekazuje wartość z steps.tag.outputs.final_tag.
variable "BPP_IMAGE_TAG" {
default = "unknown"
}
# Alias = nazwa source brancha PR-a (sanityzowana). Empty dla master/non-PR
# pushy. Workflow przekazuje z steps.tag.outputs.branch_tag.
variable "BPP_BRANCH_TAG" {
default = ""
}
variable "TAG_LATEST" {
default = "true"
}
# R16: zstd compression przy pushu do rejestru (~20-30% mniejszy transfer
# pull/push niz gzip). Dotyczy TYLKO `type=registry` — lokalny `type=docker`
# zapisuje uncompressed do daemon storage. Override wartosci:
# COMPRESSION=gzip make build # stare zachowanie
# COMPRESSION_LEVEL=9 make build # wyzsza kompresja, wolniejszy push
# Docker Hub wspiera zstd od 2023; klienci z Docker 23+ pullna natywnie,
# starsi dostana gzip fallback (koszt po stronie rejestru).
variable "COMPRESSION" {
default = "zstd"
}
variable "COMPRESSION_LEVEL" {
default = "3"
}
# Build groups for different scenarios
group "default" {
targets = ["appserver", "workerserver",
"beatserver", "authserver", "denorm-queue"]
}
group "base-only" {
targets = ["base"]
}
group "app-services" {
targets = ["appserver", "workerserver", "beatserver", "authserver", "denorm-queue"]
}
# Base image - critical path, app services depend on this
target "base" {
dockerfile = "docker/bpp_base/Dockerfile"
context = "."
args = {
GIT_SHA = GIT_SHA
BPP_BUILD_FLAVOR = BPP_BUILD_FLAVOR
BPP_IMAGE_TAG = BPP_IMAGE_TAG
BPP_BRANCH_TAG = BPP_BRANCH_TAG
}
tags = TAG_LATEST == "true" ? [
"iplweb/bpp_base:${DOCKER_VERSION}",
"iplweb/bpp_base:latest"
] : [
"iplweb/bpp_base:${DOCKER_VERSION}"
]
# Always rebuild base from scratch — Docker Build Cloud's layer cache has
# produced stale bpp_base images (missing files added in fresh COPY lines).
# Package downloads remain fast thanks to cache mounts inside
# docker/bpp_base/Dockerfile (apt-cache, apt-lists, uv-cache, npm-cache,
# yarn-cache) which persist across --no-cache builds.
no-cache = true
platforms = [PLATFORM]
output = PUSH ? ["type=registry,compression=${COMPRESSION},compression-level=${COMPRESSION_LEVEL},force-compression=true"] : ["type=docker"]
}
# Dependent images - wait for base to complete via contexts dependency
target "appserver" {
dockerfile = "docker/appserver/Dockerfile"
context = "."
args = {
BPP_BASE_TAG = DOCKER_VERSION
}
contexts = {
"iplweb/bpp_base:${DOCKER_VERSION}" = "target:base"
}
tags = TAG_LATEST == "true" ? [
"iplweb/bpp_appserver:${DOCKER_VERSION}",
"iplweb/bpp_appserver:latest"
] : [
"iplweb/bpp_appserver:${DOCKER_VERSION}"
]
platforms = [PLATFORM]
output = PUSH ? ["type=registry,compression=${COMPRESSION},compression-level=${COMPRESSION_LEVEL},force-compression=true"] : ["type=docker"]
}
target "workerserver" {
dockerfile = "docker/workerserver/Dockerfile"
context = "."
args = {
BPP_BASE_TAG = DOCKER_VERSION
}
contexts = {
"iplweb/bpp_base:${DOCKER_VERSION}" = "target:base"
}
tags = TAG_LATEST == "true" ? [
"iplweb/bpp_workerserver:${DOCKER_VERSION}",
"iplweb/bpp_workerserver:latest"
] : [
"iplweb/bpp_workerserver:${DOCKER_VERSION}"
]
platforms = [PLATFORM]
output = PUSH ? ["type=registry,compression=${COMPRESSION},compression-level=${COMPRESSION_LEVEL},force-compression=true"] : ["type=docker"]
}
target "beatserver" {
dockerfile = "docker/beatserver/Dockerfile"
context = "."
args = {
BPP_BASE_TAG = DOCKER_VERSION
}
contexts = {
"iplweb/bpp_base:${DOCKER_VERSION}" = "target:base"
}
tags = TAG_LATEST == "true" ? [
"iplweb/bpp_beatserver:${DOCKER_VERSION}",
"iplweb/bpp_beatserver:latest"
] : [
"iplweb/bpp_beatserver:${DOCKER_VERSION}"
]
platforms = [PLATFORM]
output = PUSH ? ["type=registry,compression=${COMPRESSION},compression-level=${COMPRESSION_LEVEL},force-compression=true"] : ["type=docker"]
}
target "authserver" {
dockerfile = "docker/authserver/Dockerfile"
context = "."
args = {
BPP_BASE_TAG = DOCKER_VERSION
}
contexts = {
"iplweb/bpp_base:${DOCKER_VERSION}" = "target:base"
}
tags = TAG_LATEST == "true" ? [
"iplweb/bpp_authserver:${DOCKER_VERSION}",
"iplweb/bpp_authserver:latest"
] : [
"iplweb/bpp_authserver:${DOCKER_VERSION}"
]
platforms = [PLATFORM]
output = PUSH ? ["type=registry,compression=${COMPRESSION},compression-level=${COMPRESSION_LEVEL},force-compression=true"] : ["type=docker"]
}
target "denorm-queue" {
dockerfile = "docker/denorm-queue/Dockerfile"
context = "."
args = {
BPP_BASE_TAG = DOCKER_VERSION
}
contexts = {
"iplweb/bpp_base:${DOCKER_VERSION}" = "target:base"
}
tags = TAG_LATEST == "true" ? [
"iplweb/bpp_denorm_queue:${DOCKER_VERSION}",
"iplweb/bpp_denorm_queue:latest"
] : [
"iplweb/bpp_denorm_queue:${DOCKER_VERSION}"
]
platforms = [PLATFORM]
output = PUSH ? ["type=registry,compression=${COMPRESSION},compression-level=${COMPRESSION_LEVEL},force-compression=true"] : ["type=docker"]
}