forked from zitadel/typescript
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdocker-bake.hcl
More file actions
163 lines (142 loc) · 4.76 KB
/
Copy pathdocker-bake.hcl
File metadata and controls
163 lines (142 loc) · 4.76 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
variable "LOGIN_DIR" {
default = "./"
}
variable "DOCKERFILES_DIR" {
default = "dockerfiles/"
}
# The release target is overwritten in docker-bake-release.hcl
# It makes sure the image is built for multiple platforms.
# By default the platforms property is empty, so images are only built for the current bake runtime platform.
target "release" {}
# typescript-proto-client is used to generate the client code for the login service.
# It is not login-prefixed, so it is easily extendable.
# To extend this bake-file.hcl, set the context of all login-prefixed targets to a different directory.
# For example docker bake --file login/docker-bake.hcl --file docker-bake.hcl --set login-*.context=./login/
# The zitadel repository uses this to generate the client and the mock server from local proto files.
target "typescript-proto-client" {
inherits = ["release"]
dockerfile = "${DOCKERFILES_DIR}typescript-proto-client.Dockerfile"
contexts = {
# We directly generate and download the client server-side with buf, so we don't need the proto files
login-pnpm = "target:login-pnpm"
}
}
# We prefix the target with login- so we can reuse the writing of protos if we overwrite the typescript-proto-client target.
target "login-typescript-proto-client-out" {
dockerfile = "${DOCKERFILES_DIR}login-typescript-proto-client-out.Dockerfile"
contexts = {
typescript-proto-client = "target:typescript-proto-client"
}
output = [
"type=local,dest=${LOGIN_DIR}packages/zitadel-proto"
]
}
# proto-files is only used to build core-mock against which the integration tests run.
# To build the proto-client, we use buf to generate and download the client code directly.
# It is not login-prefixed, so it is easily extendable.
# To extend this bake-file.hcl, set the context of all login-prefixed targets to a different directory.
# For example docker bake --file login/docker-bake.hcl --file docker-bake.hcl --set login-*.context=./login/
# The zitadel repository uses this to generate the client and the mock server from local proto files.
target "proto-files" {
inherits = ["release"]
dockerfile = "${DOCKERFILES_DIR}proto-files.Dockerfile"
contexts = {
login-pnpm = "target:login-pnpm"
}
}
variable "NODE_VERSION" {
default = "20"
}
target "login-pnpm" {
inherits = ["release"]
dockerfile = "${DOCKERFILES_DIR}login-pnpm.Dockerfile"
args = {
NODE_VERSION = "${NODE_VERSION}"
}
}
target "login-dev-base" {
dockerfile = "${DOCKERFILES_DIR}login-dev-base.Dockerfile"
contexts = {
login-pnpm = "target:login-pnpm"
}
}
target "login-lint" {
dockerfile = "${DOCKERFILES_DIR}login-lint.Dockerfile"
contexts = {
login-dev-base = "target:login-dev-base"
}
}
target "login-test-unit" {
dockerfile = "${DOCKERFILES_DIR}login-test-unit.Dockerfile"
contexts = {
login-client = "target:login-client"
}
}
target "login-client" {
inherits = ["release"]
dockerfile = "${DOCKERFILES_DIR}login-client.Dockerfile"
contexts = {
login-pnpm = "target:login-pnpm"
typescript-proto-client = "target:typescript-proto-client"
}
}
variable "LOGIN_CORE_MOCK_TAG" {
default = "login-core-mock:local"
}
# the core-mock context must not be overwritten, so we don't prefix it with login-.
target "core-mock" {
context = "${LOGIN_DIR}apps/login-test-integration/core-mock"
contexts = {
protos = "target:proto-files"
}
tags = ["${LOGIN_CORE_MOCK_TAG}"]
}
variable "LOGIN_TEST_INTEGRATION_TAG" {
default = "login-test-integration:local"
}
target "login-test-integration" {
dockerfile = "${DOCKERFILES_DIR}login-test-integration.Dockerfile"
contexts = {
login-pnpm = "target:login-pnpm"
}
tags = ["${LOGIN_TEST_INTEGRATION_TAG}"]
}
variable "LOGIN_TEST_ACCEPTANCE_TAG" {
default = "login-test-acceptance:local"
}
target "login-test-acceptance" {
dockerfile = "${DOCKERFILES_DIR}login-test-acceptance.Dockerfile"
contexts = {
login-pnpm = "target:login-pnpm"
}
tags = ["${LOGIN_TEST_ACCEPTANCE_TAG}"]
}
variable "LOGIN_TAG" {
default = "zitadel-login:local"
}
target "docker-metadata-action" {
# In the pipeline, this target is overwritten by the docker metadata action.
tags = ["${LOGIN_TAG}"]
}
# We run integration and acceptance tests against the next standalone server for docker.
target "login-standalone" {
inherits = [
"docker-metadata-action",
"release",
]
dockerfile = "${DOCKERFILES_DIR}login-standalone.Dockerfile"
contexts = {
login-client = "target:login-client"
}
secret = [
"id=sentry_auth_token,env=SENTRY_AUTH_TOKEN",
"id=next_server_actions_encryption_key,env=NEXT_SERVER_ACTIONS_ENCRYPTION_KEY",
]
}
target "login-standalone-out" {
inherits = ["login-standalone"]
target = "login-standalone-out"
output = [
"type=local,dest=${LOGIN_DIR}apps/login/standalone"
]
}