2022-07-14 14:00:06 +02:00
|
|
|
# build.hcl
|
|
|
|
# For more information on buildx bake file definition see:
|
|
|
|
# https://github.com/docker/buildx/blob/master/docs/guides/bake/file-definition.md
|
|
|
|
#
|
|
|
|
# NOTE: You can only run this from the Mailu root folder.
|
|
|
|
# Make sure the context is Mailu (project folder) and not Mailu/tests
|
|
|
|
#-----------------------------------------------------------------------------------------
|
|
|
|
# (Environment) input variables
|
|
|
|
# If the env var is not set, then the default value is used
|
|
|
|
#-----------------------------------------------------------------------------------------
|
|
|
|
variable "DOCKER_ORG" {
|
|
|
|
default = "mailu"
|
|
|
|
}
|
|
|
|
variable "DOCKER_PREFIX" {
|
|
|
|
default = ""
|
|
|
|
}
|
|
|
|
variable "PINNED_MAILU_VERSION" {
|
|
|
|
default = "local"
|
|
|
|
}
|
|
|
|
variable "MAILU_VERSION" {
|
|
|
|
default = "local"
|
|
|
|
}
|
2023-03-17 15:05:33 +02:00
|
|
|
variable "LABEL_VERSION" {
|
|
|
|
default = "local"
|
|
|
|
}
|
|
|
|
variable "PINNED_LABEL_VERSION" {
|
|
|
|
default = "local"
|
|
|
|
}
|
2022-07-14 14:00:06 +02:00
|
|
|
|
|
|
|
#-----------------------------------------------------------------------------------------
|
|
|
|
# Grouping of targets to build. All these images are built when using:
|
|
|
|
# docker buildx bake -f tests\build.hcl
|
|
|
|
#-----------------------------------------------------------------------------------------
|
|
|
|
group "default" {
|
|
|
|
targets = [
|
|
|
|
"docs",
|
|
|
|
"setup",
|
|
|
|
|
|
|
|
"admin",
|
|
|
|
"antispam",
|
|
|
|
"front",
|
|
|
|
"imap",
|
2022-11-23 16:42:46 +02:00
|
|
|
"oletools",
|
2022-07-14 14:00:06 +02:00
|
|
|
"smtp",
|
|
|
|
|
2022-11-12 12:34:58 +02:00
|
|
|
"webmail",
|
2022-07-14 14:00:06 +02:00
|
|
|
|
|
|
|
"fetchmail",
|
|
|
|
"resolver",
|
|
|
|
"traefik-certdumper",
|
|
|
|
"webdav"
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
|
|
|
#-----------------------------------------------------------------------------------------
|
|
|
|
# Default settings that will be inherited by all targets (images to build).
|
|
|
|
#-----------------------------------------------------------------------------------------
|
|
|
|
target "defaults" {
|
|
|
|
platforms = [ "linux/amd64"]
|
|
|
|
dockerfile = "Dockerfile"
|
|
|
|
args = {
|
2023-03-17 15:05:33 +02:00
|
|
|
VERSION = "${PINNED_LABEL_VERSION}"
|
2022-07-14 14:00:06 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#-----------------------------------------------------------------------------------------
|
|
|
|
# User defined functions
|
|
|
|
#------------------------------------------------------------------------------------------
|
|
|
|
# Derive all tags
|
|
|
|
function "tag" {
|
|
|
|
params = [image_name]
|
|
|
|
result = [ notequal("master",MAILU_VERSION) && notequal("master-arm",MAILU_VERSION) ? "${DOCKER_ORG}/${DOCKER_PREFIX}${image_name}:${PINNED_MAILU_VERSION}": "",
|
|
|
|
"${DOCKER_ORG}/${DOCKER_PREFIX}${image_name}:${MAILU_VERSION}",
|
|
|
|
"${DOCKER_ORG}/${DOCKER_PREFIX}${image_name}:latest"
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
|
|
|
#-----------------------------------------------------------------------------------------
|
|
|
|
# All individual targets (images to build)
|
|
|
|
# Build an individual target using.
|
|
|
|
# docker buildx bake -f tests\build.hcl <target>
|
|
|
|
# E.g. to build target docs
|
|
|
|
# docker buildx bake -f tests\build.hcl docs
|
|
|
|
#-----------------------------------------------------------------------------------------
|
|
|
|
|
2022-09-27 22:09:07 +02:00
|
|
|
# -----------------------------------------------------------------------------------------
|
|
|
|
# Base images
|
|
|
|
# -----------------------------------------------------------------------------------------
|
|
|
|
target "base" {
|
|
|
|
inherits = ["defaults"]
|
2022-10-08 15:55:40 +02:00
|
|
|
context = "core/base/"
|
2022-09-27 22:09:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
target "assets" {
|
|
|
|
inherits = ["defaults"]
|
2022-10-08 15:55:40 +02:00
|
|
|
context = "core/admin/assets/"
|
2022-09-27 22:09:07 +02:00
|
|
|
}
|
|
|
|
|
2022-07-14 14:00:06 +02:00
|
|
|
# -----------------------------------------------------------------------------------------
|
|
|
|
# Documentation and setup images
|
|
|
|
# -----------------------------------------------------------------------------------------
|
|
|
|
target "docs" {
|
|
|
|
inherits = ["defaults"]
|
2022-10-08 15:55:40 +02:00
|
|
|
context = "docs/"
|
2022-07-14 14:00:06 +02:00
|
|
|
tags = tag("docs")
|
|
|
|
args = {
|
2023-03-17 15:05:33 +02:00
|
|
|
version = "${LABEL_VERSION}"
|
|
|
|
pinned_version = "${PINNED_LABEL_VERSION}"
|
2022-07-14 14:00:06 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
target "setup" {
|
|
|
|
inherits = ["defaults"]
|
2022-10-08 15:55:40 +02:00
|
|
|
context = "setup/"
|
2022-11-17 15:18:51 +02:00
|
|
|
contexts = {
|
|
|
|
base = "target:base"
|
|
|
|
}
|
2022-07-14 14:00:06 +02:00
|
|
|
tags = tag("setup")
|
|
|
|
}
|
|
|
|
|
|
|
|
# -----------------------------------------------------------------------------------------
|
|
|
|
# Core images
|
|
|
|
# -----------------------------------------------------------------------------------------
|
|
|
|
target "none" {
|
|
|
|
inherits = ["defaults"]
|
2022-10-08 15:55:40 +02:00
|
|
|
context = "core/none/"
|
|
|
|
contexts = {
|
2022-09-27 22:09:07 +02:00
|
|
|
base = "target:base"
|
|
|
|
}
|
2022-07-14 14:00:06 +02:00
|
|
|
tags = tag("none")
|
|
|
|
}
|
|
|
|
|
|
|
|
target "admin" {
|
|
|
|
inherits = ["defaults"]
|
2022-10-08 15:55:40 +02:00
|
|
|
context = "core/admin/"
|
|
|
|
contexts = {
|
2022-09-27 22:09:07 +02:00
|
|
|
base = "target:base"
|
|
|
|
assets = "target:assets"
|
|
|
|
}
|
2022-07-14 14:00:06 +02:00
|
|
|
tags = tag("admin")
|
|
|
|
}
|
|
|
|
|
|
|
|
target "antispam" {
|
|
|
|
inherits = ["defaults"]
|
2022-10-08 15:55:40 +02:00
|
|
|
context = "core/rspamd/"
|
|
|
|
contexts = {
|
2022-09-27 22:09:07 +02:00
|
|
|
base = "target:base"
|
|
|
|
}
|
2022-07-14 14:00:06 +02:00
|
|
|
tags = tag("rspamd")
|
|
|
|
}
|
|
|
|
|
|
|
|
target "front" {
|
|
|
|
inherits = ["defaults"]
|
2022-10-08 15:55:40 +02:00
|
|
|
context = "core/nginx/"
|
|
|
|
contexts = {
|
2022-09-27 22:09:07 +02:00
|
|
|
base = "target:base"
|
|
|
|
}
|
2022-07-14 14:00:06 +02:00
|
|
|
tags = tag("nginx")
|
|
|
|
}
|
|
|
|
|
2022-11-23 16:42:46 +02:00
|
|
|
target "oletools" {
|
|
|
|
inherits = ["defaults"]
|
|
|
|
context = "core/oletools/"
|
|
|
|
contexts = {
|
|
|
|
base = "target:base"
|
|
|
|
}
|
|
|
|
tags = tag("oletools")
|
|
|
|
}
|
|
|
|
|
2022-07-14 14:00:06 +02:00
|
|
|
target "imap" {
|
|
|
|
inherits = ["defaults"]
|
2022-10-08 15:55:40 +02:00
|
|
|
context = "core/dovecot/"
|
|
|
|
contexts = {
|
2022-09-27 22:09:07 +02:00
|
|
|
base = "target:base"
|
|
|
|
}
|
2022-07-14 14:00:06 +02:00
|
|
|
tags = tag("dovecot")
|
|
|
|
}
|
|
|
|
|
|
|
|
target "smtp" {
|
|
|
|
inherits = ["defaults"]
|
2022-10-08 15:55:40 +02:00
|
|
|
context = "core/postfix/"
|
|
|
|
contexts = {
|
2022-09-27 22:09:07 +02:00
|
|
|
base = "target:base"
|
|
|
|
}
|
2022-07-14 14:00:06 +02:00
|
|
|
tags = tag("postfix")
|
|
|
|
}
|
|
|
|
|
|
|
|
# -----------------------------------------------------------------------------------------
|
2022-11-12 12:34:58 +02:00
|
|
|
# Webmail image
|
2022-07-14 14:00:06 +02:00
|
|
|
# -----------------------------------------------------------------------------------------
|
2022-11-12 12:34:58 +02:00
|
|
|
target "webmail" {
|
2022-07-14 14:00:06 +02:00
|
|
|
inherits = ["defaults"]
|
2022-11-12 12:34:58 +02:00
|
|
|
context = "webmails/"
|
2022-11-10 17:51:22 +02:00
|
|
|
contexts = {
|
|
|
|
base = "target:base"
|
|
|
|
}
|
2022-11-12 12:34:58 +02:00
|
|
|
tags = tag("webmail")
|
2022-07-14 14:00:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
# -----------------------------------------------------------------------------------------
|
|
|
|
# Optional images
|
|
|
|
# -----------------------------------------------------------------------------------------
|
|
|
|
target "fetchmail" {
|
|
|
|
inherits = ["defaults"]
|
2022-10-08 15:55:40 +02:00
|
|
|
context = "optional/fetchmail/"
|
|
|
|
contexts = {
|
|
|
|
base = "target:base"
|
|
|
|
}
|
2022-07-14 14:00:06 +02:00
|
|
|
tags = tag("fetchmail")
|
|
|
|
}
|
|
|
|
|
|
|
|
target "resolver" {
|
|
|
|
inherits = ["defaults"]
|
2022-10-08 15:55:40 +02:00
|
|
|
context = "optional/unbound/"
|
|
|
|
contexts = {
|
|
|
|
base = "target:base"
|
|
|
|
}
|
2022-07-14 14:00:06 +02:00
|
|
|
tags = tag("unbound")
|
|
|
|
}
|
|
|
|
|
|
|
|
target "traefik-certdumper" {
|
|
|
|
inherits = ["defaults"]
|
2022-10-08 15:55:40 +02:00
|
|
|
context = "optional/traefik-certdumper/"
|
2022-07-14 14:00:06 +02:00
|
|
|
tags = tag("traefik-certdumper")
|
|
|
|
}
|
|
|
|
|
|
|
|
target "webdav" {
|
|
|
|
inherits = ["defaults"]
|
2022-10-08 15:55:40 +02:00
|
|
|
context = "optional/radicale/"
|
|
|
|
contexts = {
|
|
|
|
base = "target:base"
|
|
|
|
}
|
2022-07-14 14:00:06 +02:00
|
|
|
tags = tag("radicale")
|
2022-09-27 22:09:07 +02:00
|
|
|
}
|