Skip to content

Instantly share code, notes, and snippets.

@panekj
Created February 5, 2024 20:26
Show Gist options
  • Save panekj/ac52f742a8a5217e1c86a3a55142aa89 to your computer and use it in GitHub Desktop.
Save panekj/ac52f742a8a5217e1c86a3a55142aa89 to your computer and use it in GitHub Desktop.
variable "RUST_VERSION" {
default = "1.75"
}
variable "PACKAGE_NAME" {
default = "lapce-nightly"
}
variable "PACKAGE_VERSION" {
default = "nightly"
}
variable "RELEASE_TAG_NAME" {
default = ""
}
variable "XX_VERSION" {
default = "latest"
}
target "_common" {
output = ["target/"]
args = {
PACKAGE_NAME = PACKAGE_NAME
PACKAGE_VERSION = PACKAGE_VERSION
RUST_VERSION = RUST_VERSION
RELEASE_TAG_NAME = RELEASE_TAG_NAME
BUILDKIT_CONTEXT_KEEP_GIT_DIR = 1
OUTPUT_DIR = "/output"
}
}
variable "platforms" {
default = [
"linux/amd64",
// "linux/arm/v6",
// "linux/arm/v7",
"linux/arm64",
// "linux/ppc64le",
// "linux/riscv64",
// "linux/s390x",
]
}
target "_platforms" {
platforms = platforms
}
group "default" {
targets = ["binary"]
}
target "binary" {
inherits = ["_common"]
target = "binary"
platforms = ["local"]
output = ["target"]
}
target "cross-binary" {
inherits = ["binary", "_platforms"]
}
// OS
variable "DPKG_FAMILY_PACKAGES" {
default = [
"libc6-dev",
"libssl-dev",
"zlib1g-dev",
"libzstd-dev",
"libvulkan-dev",
"libwayland-dev",
"libxcb-shape0-dev",
"libxcb-xfixes0-dev",
"libxkbcommon-x11-dev",
]
}
target "debian" {
inherits = ["cross-binary"]
name = "${distro}-${build.os_version}"
target = "cross-binary"
context = "."
dockerfile = "extra/linux/docker/${distro}/Dockerfile"
args = {
DISTRIBUTION_NAME = distro
DISTRIBUTION_VERSION = build.os_version
DISTRIBUTION_PACKAGES = join(" ", build.packages)
}
matrix = {
distro = ["debian"]
build = [
{
os_version = "bullseye"
packages = DPKG_FAMILY_PACKAGES
},
{
os_version = "bookworm"
packages = DPKG_FAMILY_PACKAGES
},
]
}
}
target "ubuntu" {
inherits = ["cross-binary"]
name = "${distro}-${build.os_version}"
target = "cross-binary"
context = "."
dockerfile = "extra/linux/docker/${distro}/Dockerfile"
args = {
DISTRIBUTION_NAME = distro
DISTRIBUTION_VERSION = build.os_version
DISTRIBUTION_PACKAGES = join(" ", build.packages)
}
platforms = coalesce(build.platforms, platforms)
matrix = {
distro = ["ubuntu"]
build = [
# 20.04
{ os_version = "focal", packages = distinct(concat(DPKG_FAMILY_PACKAGES, [])), platforms = null },
# 22.04
{ os_version = "jammy", packages = distinct(concat(DPKG_FAMILY_PACKAGES, [])), platforms = ["linux/amd64"] },
# 22.10
{ os_version = "kinet", packages = distinct(concat(DPKG_FAMILY_PACKAGES, [])), platforms = ["linux/amd64"] },
# 23.04
{ os_version = "lunar", packages = distinct(concat(DPKG_FAMILY_PACKAGES, [])), platforms = null },
# 23.10
{ os_version = "mantic", packages = distinct(concat(DPKG_FAMILY_PACKAGES, [])), platforms = null },
# 24.04
{ os_version = "noble", packages = distinct(concat(DPKG_FAMILY_PACKAGES, [])), platforms = null },
]
}
}
variable "RHEL_FAMILY_PACKAGES" {
default = [
"wayland-devel",
"vulkan-loader-devel",
"libxcb-devel",
"libxkbcommon-x11-devel",
]
}
target "fedora" {
inherits = ["cross-binary"]
name = "${distro}-${build.os_version}"
target = "cross-binary"
context = "."
dockerfile = "extra/linux/docker/${distro}/Dockerfile"
args = {
XX_VERSION = "test"
DISTRIBUTION_NAME = distro
DISTRIBUTION_VERSION = build.os_version
DISTRIBUTION_PACKAGES = join(" ", build.packages)
}
platforms = coalesce(build.platforms, platforms)
matrix = {
distro = ["fedora"]
build = [
{
os_version = "39"
packages = distinct(concat(RHEL_FAMILY_PACKAGES, []))
platforms = null
},
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment