import os
from pathlib import Path
import dagger
_ALPINE_COMMON_PACKAGES = [
"alpine-sdk",
"autoconf",
"automake",
"bash",
"binutils",
"bison",
"cmake",
"curl",
"curl-static",
"elfutils-dev",
"flex",
"gcc",
"git",
"gnutls-dev",
"gzip",
"jq",
"libelf-static",
"libmnl-dev",
"libmnl-static",
"libtool",
"libuv-dev",
"libuv-static",
"lz4-dev",
"lz4-static",
"make",
"mongo-c-driver-dev",
"mongo-c-driver-static",
"musl-fts-dev",
"ncurses",
"ncurses-static",
"netcat-openbsd",
"ninja",
"openssh",
"pcre2-dev",
"pkgconfig",
"protobuf-dev",
"snappy-dev",
"snappy-static",
"util-linux-dev",
"wget",
"xz",
"yaml-dev",
"yaml-static",
"zlib-dev",
"zlib-static",
"zstd-dev",
"zstd-static",
]
def build_alpine_3_18(client, platform):
ctr = client.container(platform=platform).from_("alpine:3.18")
pkgs = [pkg for pkg in _ALPINE_COMMON_PACKAGES]
ctr = (
ctr.with_exec(["apk", "add", "--no-cache"] + pkgs)
)
return ctr
def build_alpine_3_19(client, platform: dagger.Platform):
ctr = client.container(platform=platform).from_("alpine:3.19")
pkgs = [pkg for pkg in _ALPINE_COMMON_PACKAGES]
ctr = (
ctr.with_exec(["apk", "add", "--no-cache"] + pkgs)
)
return ctr
def static_build_openssl(client: dagger.Client, ctr: dagger.Container):
tree = (
client.git(url="https://github.com/openssl/openssl", keep_git_dir=True)
.tag("openssl-3.1.4").tree()
)
#
# TODO: verify 32-bit builds
#
ctr = (
ctr.with_directory("/openssl", tree)
.with_workdir("/openssl"