Repository navigation
Expand file tree
/
Copy pathdocker-bake.hcl
More file actions
81 lines (72 loc) · 2.01 KB
/
Copy pathdocker-bake.hcl
File metadata and controls
81 lines (72 loc) · 2.01 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
variable "DEFAULT_TAG" {
default = "synapse:local"
}
// Special target: https://github.com/docker/metadata-action#bake-definition
target "docker-metadata-action" {
tags = ["${DEFAULT_TAG}"]
}
// Default target if none specified
group "default" {
targets = ["image-local"]
}
// For CI and builds that need private deps: set GITHUB_TOKEN in the environment
// (e.g. export GITHUB_TOKEN=your_token or use REPO_ACCESS_TOKEN in CI).
target "image" {
inherits = ["docker-metadata-action"]
context = "."
dockerfile = "pkg/docker/Dockerfile"
args = {
REQUIRE_GITHUB_TOKEN = "1"
}
secrets = ["id=github_token,env=GITHUB_TOKEN"]
}
target "image-local" {
inherits = ["image"]
output = ["type=docker"]
}
// Local build without token (public deps only). Use when GITHUB_TOKEN is not set.
target "image-local-public" {
inherits = ["docker-metadata-action"]
context = "."
dockerfile = "pkg/docker/Dockerfile"
args = {
REQUIRE_GITHUB_TOKEN = "0"
}
output = ["type=docker"]
}
// Local build with token from file (avoids env not reaching container builder).
// Run from moat dir:
// echo -n "$GITHUB_TOKEN" > .github_token && test -s .github_token
// docker buildx bake -f docker-bake.hcl \
// --set "image-local-file.secrets=id=github_token,src=$PWD/.github_token" \
// --set "*.platform=linux/amd64" --set "*.output=type=docker" image-local-file
target "image-local-file" {
inherits = ["docker-metadata-action"]
context = "."
dockerfile = "pkg/docker/Dockerfile"
args = {
REQUIRE_GITHUB_TOKEN = "1"
}
secrets = ["id=github_token,src=.github_token"]
output = ["type=docker"]
}
target "image-all" {
inherits = ["image"]
platforms = [
"linux/amd64",
"linux/arm64",
]
}
// CI release target: uses pre-built binary (no compilation)
target "image-release" {
inherits = ["docker-metadata-action"]
context = "."
dockerfile = "pkg/docker/Dockerfile.release"
}
target "image-release-all" {
inherits = ["image-release"]
platforms = [
"linux/amd64",
"linux/arm64",
]
}