@@ -6,17 +6,63 @@ variable "VERSION" {
66 default = " latest"
77}
88
9+ variable "DOCKER_REGISTRY" {
10+ default = " docker.io/codercom/code-server"
11+ }
12+
13+ variable "GITHUB_REGISTRY" {
14+ default = " ghcr.io/coder/code-server"
15+ }
16+
917group "default" {
10- targets = [" code-server" ]
18+ targets = [
19+ " code-server-debian-11" ,
20+ " code-server-ubuntu-focal" ,
21+ ]
22+ }
23+
24+ function "prepend_hyphen_if_not_null" {
25+ params = [tag ]
26+ result = notequal (" " ," ${ tag } " ) ? " -${ tag } " : " ${ tag } "
27+ }
28+
29+ # use empty tag (tag="") to generate default tags
30+ function "gen_tags" {
31+ params = [registry , tag ]
32+ result = notequal (" " ," ${ registry } " ) ? [
33+ notequal (" " , " ${ tag } " ) ? " ${ registry } :${ tag } " : " ${ registry } :latest" ,
34+ notequal (" latest" ,VERSION) ? " ${ registry } :${ VERSION } ${ prepend_hyphen_if_not_null (tag)} " : " " ,
35+ ] : []
36+ }
37+
38+ # helper function to generate tags for docker registry and github registry.
39+ # set (DOCKER|GITHUB)_REGISTRY="" to disable corresponding registry
40+ function "gen_tags_for_docker_and_ghcr" {
41+ params = [tag ]
42+ result = concat (
43+ gen_tags (" ${ DOCKER_REGISTRY } " , " ${ tag } " ),
44+ gen_tags (" ${ GITHUB_REGISTRY } " , " ${ tag } " ),
45+ )
1146}
1247
13- target "code-server" {
48+ target "code-server-debian-11 " {
1449 dockerfile = " ci/release-image/Dockerfile"
15- tags = [
16- " docker.io/codercom/code-server:latest" ,
17- notequal (" latest" ,VERSION) ? " docker.io/codercom/code-server:${ VERSION } " : " " ,
18- " ghcr.io/coder/code-server:latest" ,
19- notequal (" latest" ,VERSION) ? " ghcr.io/coder/code-server:${ VERSION } " : " " ,
20- ]
50+ tags = concat (
51+ gen_tags_for_docker_and_ghcr (" " ),
52+ gen_tags_for_docker_and_ghcr (" debian" ),
53+ gen_tags_for_docker_and_ghcr (" bullseye" ),
54+ )
55+ platforms = [" linux/amd64" , " linux/arm64" ]
56+ }
57+
58+ target "code-server-ubuntu-focal" {
59+ dockerfile = " ci/release-image/Dockerfile"
60+ tags = concat (
61+ gen_tags_for_docker_and_ghcr (" ubuntu" ),
62+ gen_tags_for_docker_and_ghcr (" focal" ),
63+ )
64+ args = {
65+ BASE = " ubuntu:focal"
66+ }
2167 platforms = [" linux/amd64" , " linux/arm64" ]
2268}
0 commit comments