-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-bake.hcl
More file actions
108 lines (94 loc) · 2.4 KB
/
docker-bake.hcl
File metadata and controls
108 lines (94 loc) · 2.4 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
variable "BUILD_CONFIGURATION" {
default = "dev"
type = string
description = "Build configuration of the application (dev|release)"
validation {
condition = equal(regex("^dev$|^release$", BUILD_CONFIGURATION), BUILD_CONFIGURATION)
error_message = "BUILD_CONFIGURATION must be 'dev' or 'release'"
}
}
variable "VERSION" {
default = "dev"
type = string
description = "Version of the application"
validation {
condition = equal(regex("^$|^dev$|^[0-9]+.[0-9]+.[0-9]+$", VERSION), VERSION)
}
}
// Base target for shared configuration
target "docker-metadata-action" {
tags = ["msgtausch:${VERSION}"]
}
// Build target for creating builder base
target "builder-base" {
target = "builder"
dockerfile = "Dockerfile"
}
// Target for generating templ files
target "templ" {
target = "templ-generate"
dockerfile = "Dockerfile"
output = ["type=cacheonly"]
}
// Target for verifying code formatting with gofmt
target "format" {
target = "format-check"
dockerfile = "Dockerfile"
output = ["type=cacheonly"]
}
// Target for running tests
target "test" {
target = "unit-test"
dockerfile = "Dockerfile"
output = ["type=cacheonly"]
}
// Target for development build
target "build" {
target = "runtime-${BUILD_CONFIGURATION}"
platforms = [
"linux/amd64",
"linux/arm64"
]
output = ["./bin"]
}
target "simulation" {
target = "simulation"
dockerfile = "Dockerfile"
output = ["type=cacheonly"]
}
target "proxy-test" {
target = "proxy-test"
dockerfile = "Dockerfile"
output = ["type=cacheonly"]
}
// Target for running compose-intercept integration tests
target "compose-intercept-test" {
context = "./tests/compose-intercept"
dockerfile-inline = <<EOF
FROM docker/compose:2.23.3
RUN apk add --no-cache bash curl
WORKDIR /test
COPY . .
CMD ["docker-compose", "up", "--build", "--abort-on-container-exit", "--exit-code-from", "client"]
EOF
output = ["type=cacheonly"]
}
target "nix" {
target = "nix-build"
dockerfile = "Dockerfile"
output = ["type=cacheonly"]
}
// Target for creating release artifacts
target "release" {
inherits = ["build"]
tags = ["msgtausch:${VERSION}"]
output = ["./release"]
}
// Default group including tests and build
group "default" {
targets = ["templ", "format", "test", "proxy-test", "build"]
}
// CI group for continuous integration
group "ci" {
targets = ["templ", "format", "test", "compose-intercept-test", "proxy-test", "release"]
}