-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-bake.hcl
79 lines (69 loc) · 1.68 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
// Variables with defaults that can be overridden
variable "REGISTRY_URL" {
default = "ghcr.io"
}
variable "REGISTRY_USER" {
default = "" // Set from GitHub Actions
}
variable "IMAGE_NAME" {
default = "meetup_bot" // Matches the label in Dockerfile.web
}
variable "TAG" {
default = "latest"
}
variable "DOCKERFILE" {
default = "Dockerfile.web"
}
// Base target with shared configuration
target "base" {
context = "."
dockerfile = "${DOCKERFILE}"
args = {
PYTHON_VERSION = "3.11"
}
}
// Default target that extends the base
target "build" {
inherits = ["base"]
tags = []
}
// Group target to build both platforms
group "default" {
targets = ["build"]
}
// Optional specific targets for each platform
target "amd64" {
inherits = ["build"]
platforms = ["linux/amd64"]
cache-from = [
"type=gha,scope=linux/amd64",
"type=registry,ref=${REGISTRY_URL}/${REGISTRY_USER}/${IMAGE_NAME}:buildcache"
]
cache-to = [
"type=gha,mode=max,scope=linux/amd64"
]
}
target "arm64" {
inherits = ["build"]
platforms = ["linux/arm64"]
cache-from = [
"type=gha,scope=linux/arm64",
"type=registry,ref=${REGISTRY_URL}/${REGISTRY_USER}/${IMAGE_NAME}:buildcache"
]
cache-to = [
"type=gha,mode=max,scope=linux/arm64"
]
}
// Matrix build target for multi-platform builds
target "multi-platform" {
inherits = ["build"]
platforms = ["linux/amd64", "linux/arm64"]
cache-from = [
"type=gha,scope=build",
"type=registry,ref=${REGISTRY_URL}/${REGISTRY_USER}/${IMAGE_NAME}:buildcache"
]
cache-to = [
"type=gha,mode=max,scope=build",
"type=registry,ref=${REGISTRY_URL}/${REGISTRY_USER}/${IMAGE_NAME}:buildcache,mode=max"
]
}