-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-bake.hcl
More file actions
106 lines (90 loc) · 2.26 KB
/
docker-bake.hcl
File metadata and controls
106 lines (90 loc) · 2.26 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
// Variables with defaults that can be overridden
variable "REGISTRY" {
default = "ghcr.io"
}
variable "IMAGE_NAME" {
default = "glance"
}
variable "TAG" {
default = "latest"
}
// Environment variables for build arguments
variable "FQDN" {
default = "$FQDN"
}
variable "GITHUB_TOKEN" {
default = "$GITHUB_TOKEN"
}
variable "REDDIT_APP_NAME" {
default = "$REDDIT_APP_NAME"
}
variable "REDDIT_APP_CLIENT_ID" {
default = "$REDDIT_APP_CLIENT_ID"
}
variable "REDDIT_APP_CLIENT_SECRET" {
default = "$REDDIT_APP_CLIENT_SECRET"
}
variable "MY_SECRET_TOKEN" {
default = "$MY_SECRET_TOKEN"
}
// Base target with shared configuration
target "docker-metadata-action" {
tags = [
"${REGISTRY}/${IMAGE_NAME}:${TAG}",
"${REGISTRY}/${IMAGE_NAME}:latest",
]
}
// Default target that extends the base
target "build" {
inherits = ["docker-metadata-action"]
context = "."
dockerfile = "Dockerfile"
// Build arguments from environment variables
args = {
FQDN = FQDN
GITHUB_TOKEN = GITHUB_TOKEN
REDDIT_APP_NAME = REDDIT_APP_NAME
REDDIT_APP_CLIENT_ID = REDDIT_APP_CLIENT_ID
REDDIT_APP_CLIENT_SECRET = REDDIT_APP_CLIENT_SECRET
MY_SECRET_TOKEN = MY_SECRET_TOKEN
}
// Output image will be pushed if push=true is set in GitHub Actions
}
// Group target to build both platforms
group "default" {
targets = ["build"]
}
// Optional specific targets for each platform if needed
target "amd64" {
inherits = ["build"]
platforms = ["linux/amd64"]
cache-from = ["type=gha,scope=linux/amd64"]
cache-to = ["type=gha,mode=max,scope=linux/amd64"]
}
target "arm64" {
inherits = ["build"]
platforms = ["linux/arm64"]
cache-from = ["type=gha,scope=linux/arm64"]
cache-to = ["type=gha,mode=max,scope=linux/arm64"]
// Optional arm64-specific args
args = {
OPENBLAS_NUM_THREADS = "1"
MKL_NUM_THREADS = "1"
NUMEXPR_NUM_THREADS = "1"
}
}
// Development build with secrets
target "dev" {
inherits = ["build"]
tags = ["${REGISTRY}/${IMAGE_NAME}:dev"]
}
// Production build with external secrets
target "prod" {
inherits = ["build"]
tags = ["${REGISTRY}/${IMAGE_NAME}:prod"]
}
// Matrix build target if you prefer to use it directly in bake
target "multi-platform" {
inherits = ["build"]
platforms = ["linux/amd64", "linux/arm64"]
}