forked from mindsdb/mindsdb
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-bake.hcl
More file actions
128 lines (120 loc) · 3.58 KB
/
docker-bake.hcl
File metadata and controls
128 lines (120 loc) · 3.58 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
# The default targets to be built if none are specified
group "default" {
targets = ["bare", "devel", "cloud", "cloud-cpu", "lightwood", "huggingface", "huggingface-cpu"]
}
variable "PUSH_TO_DOCKERHUB" {
default = false
}
variable "IMAGE" {
default = "mindsdb"
}
# This is a semver for releases but otherwise is a github sha
variable "VERSION" {
default = "unknown"
}
variable "PLATFORMS" {
default = "linux/amd64,linux/arm64"
}
variable PLATFORM_LIST {
default = split(",", PLATFORMS)
}
variable "BRANCH" {
default = "main"
}
variable "ECR_REPO" {
default = "454861456664.dkr.ecr.us-east-2.amazonaws.com"
}
function "get_cache_to" {
params = [image]
result = [
"type=registry,image-manifest=true,oci-mediatypes=true,mode=max,ref=${ECR_REPO}/${IMAGE}-cache:${replace("${BRANCH}", "/", "-")}-${image}"
]
}
function "get_cache_from" {
params = [image]
result = flatten([for p in PLATFORM_LIST:
split("\n", <<EOT
type=registry,ref=${ECR_REPO}/${IMAGE}-cache:${replace("${BRANCH}", "/", "-")}-${image}
type=registry,ref=${ECR_REPO}/${IMAGE}-cache:main-${image}
EOT
)
])
}
# Generate the list of tags for a given image.
# e.g. for the 'cloud' images this generates:
# - "mindsdb:cloud" - This functions as a 'latest' tag for the cloud image
# - "mindsdb:v1.2.3-cloud" - For this specific version
# The same tags are pushed to dockerhub as well if the PUSH_TO_DOCKERHUB variable is set.
function "get_tags" {
params = [image]
result = [
"${ECR_REPO}/${IMAGE}:${VERSION}${notequal(image, "bare") ? "-${image}" : ""}",
"${ECR_REPO}/${IMAGE}:${notequal(image, "bare") ? image : "latest"}",
PUSH_TO_DOCKERHUB ? "mindsdb/${IMAGE}:${VERSION}${notequal(image, "bare") ? "-${image}" : ""}" : "",
PUSH_TO_DOCKERHUB ? "mindsdb/${IMAGE}:${notequal(image, "bare") ? image : "latest"}" : ""
]
}
### OUTPUT IMAGES ###
target "base" {
dockerfile = "docker/mindsdb.Dockerfile"
platforms = PLATFORM_LIST
target = "build"
output = ["type=registry"]
}
target "images" {
name = item.name
dockerfile = "docker/mindsdb.Dockerfile"
platforms = PLATFORM_LIST
matrix = {
item = [
{
name = "bare"
extras = ""
target = ""
},
{
name = "devel"
extras = ""
target = "dev"
},
{
name = "lightwood"
extras = ".[lightwood]"
target = ""
},
{
# If you make any changes here, make them to huggingface-cpu as well
name = "huggingface"
extras = ".[huggingface]"
target = ""
},
{
name = "huggingface-cpu"
extras = ".[huggingface_cpu]"
target = ""
},
{
# If you make any changes here, make them to cloud-cpu as well
name = "cloud"
extras = ".[lightwood,huggingface,statsforecast-extra,neuralforecast-extra,timegpt,mssql,youtube,gmail,pgvector,writer,rag,github,snowflake,clickhouse,bigquery,elasticsearch,s3,dynamodb,databricks,oracle,teradata,hive,one_drive] darts datasetsforecast"
target = ""
},
{
name = "cloud-cpu"
extras = ".[lightwood,huggingface_cpu,statsforecast-extra,neuralforecast-extra,timegpt,mssql,youtube,gmail,pgvector,writer,rag,github,snowflake,clickhouse,bigquery,elasticsearch,s3,dynamodb,databricks,oracle,teradata,hive,one_drive] darts datasetsforecast"
target = ""
},
]
}
target = item.target
tags = get_tags(item.name)
args = {
EXTRAS = item.extras
}
cache-to = get_cache_to(item.name)
cache-from = get_cache_from(item.name)
contexts = {
build = "target:base"
}
output = ["type=registry"]
}