Skip to content

Instantly share code, notes, and snippets.

@callahad
Created February 20, 2024 19:49
Show Gist options
  • Save callahad/65ddbf3405da791cf682c4dc3f4fc2a1 to your computer and use it in GitHub Desktop.
Save callahad/65ddbf3405da791cf682c4dc3f4fc2a1 to your computer and use it in GitHub Desktop.
diff --git a/pkg/docker/Dockerfile.wasm_wasi_component b/pkg/docker/Dockerfile.wasm_wasi_component
index 475fc21a..78cb837f 100644
--- a/pkg/docker/Dockerfile.wasm_wasi_component
+++ b/pkg/docker/Dockerfile.wasm_wasi_component
@@ -11,6 +11,6 @@ LABEL org.opencontainers.image.version="1.32.0"
RUN set -ex \
&& savedAptMark="$(apt-mark showmanual)" \
&& apt-get update \
- && apt-get install --no-install-recommends --no-install-suggests -y ca-certificates git build-essential libssl-dev libpcre2-dev curl pkg-config \
+ && apt-get install --no-install-recommends --no-install-suggests -y ca-certificates git build-essential libssl-dev libpcre2-dev curl pkg-config libclang-dev \
&& mkdir -p /usr/lib/unit/modules /usr/lib/unit/debug-modules \
&& mkdir -p /usr/src/unit \
&& cd /usr/src/unit \
@@ -45,7 +45,7 @@ RUN set -ex \
&& make -j $NCPU unitd \
&& install -pm755 build/sbin/unitd /usr/sbin/unitd \
&& make clean \
- && export RUST_VERSION=1.71.0 \
+ && export RUST_VERSION=1.76.0 \
&& export RUSTUP_HOME=/usr/src/unit/rustup \
&& export CARGO_HOME=/usr/src/unit/cargo \
&& export PATH=/usr/src/unit/cargo/bin:$PATH \
diff --git a/pkg/docker/Makefile b/pkg/docker/Makefile
index 5170d24d..d3dbe593 100644
--- a/pkg/docker/Makefile
+++ b/pkg/docker/Makefile
@@ -17,6 +17,7 @@ CONTAINER_minimal ?= debian:$(VARIANT)-slim
CONFIGURE_minimal ?=
INSTALL_minimal ?= version
RUN_minimal ?= /bin/true
+BUILDDEPS_minimal ?=
MODULE_PREBUILD_minimal ?= /bin/true
VERSIONS_go ?= 1.21 1.22
@@ -25,6 +26,7 @@ $(foreach goversion, $(VERSIONS_go), $(eval CONTAINER_go$(goversion) = golang:$(
CONFIGURE_go ?= go --go-path=$$GOPATH
INSTALL_go ?= go-install-src libunit-install
RUN_go ?= /bin/true
+BUILDDEPS_go ?=
MODULE_PREBUILD_go ?= /bin/true
VERSIONS_jsc ?= 11
@@ -33,6 +35,7 @@ $(foreach jscversion, $(VERSIONS_jsc), $(eval CONTAINER_jsc$(jscversion) = eclip
CONFIGURE_jsc ?= java --jars=/usr/share/unit-jsc-common/
INSTALL_jsc ?= java-shared-install java-install
RUN_jsc ?= rm -rf /root/.m2
+BUILDDEPS_jsc ?=
MODULE_PREBUILD_jsc ?= /bin/true
VERSIONS_node ?= 20 21
@@ -41,6 +44,7 @@ $(foreach nodeversion, $(VERSIONS_node), $(eval CONTAINER_node$(nodeversion) = n
CONFIGURE_node ?= nodejs --node-gyp=/usr/local/bin/node-gyp
INSTALL_node ?= node node-install libunit-install
RUN_node ?= rm -rf /root/.cache/ \&\& rm -rf /root/.npm
+BUILDDEPS_node ?=
MODULE_PREBUILD_node ?= npm -g install node-gyp
VERSIONS_perl ?= 5.36 5.38
@@ -49,6 +53,7 @@ $(foreach perlversion, $(VERSIONS_perl), $(eval CONTAINER_perl$(perlversion) = p
CONFIGURE_perl ?= perl
INSTALL_perl ?= perl-install
RUN_perl ?= /bin/true
+BUILDDEPS_perl ?=
MODULE_PREBUILD_perl ?= /bin/true
VERSIONS_php ?= 8.2 8.3
@@ -57,6 +62,7 @@ $(foreach phpversion, $(VERSIONS_php), $(eval CONTAINER_php$(phpversion) = php:$
CONFIGURE_php ?= php
INSTALL_php ?= php-install
RUN_php ?= ldconfig
+BUILDDEPS_php ?=
MODULE_PREBUILD_php ?= /bin/true
VERSIONS_python ?= 3.11 3.12
@@ -65,6 +71,7 @@ $(foreach pythonversion, $(VERSIONS_python), $(eval CONTAINER_python$(pythonvers
CONFIGURE_python ?= python --config=/usr/local/bin/python3-config
INSTALL_python ?= python3-install
RUN_python ?= /bin/true
+BUILDDEPS_python ?=
MODULE_PREBUILD_python ?= /bin/true
VERSIONS_ruby ?= 3.2 3.3
@@ -73,6 +80,7 @@ $(foreach rubyversion, $(VERSIONS_ruby), $(eval CONTAINER_ruby$(rubyversion) = r
CONFIGURE_ruby ?= ruby
INSTALL_ruby ?= ruby-install
RUN_ruby ?= gem install rack \&\& rm -rf /root/.local
+BUILDDEPS_ruby ?=
MODULE_PREBUILD_ruby ?= /bin/true
VERSIONS_wasm ?=
@@ -80,6 +88,7 @@ CONTAINER_wasm ?= debian:$(VARIANT)-slim
CONFIGURE_wasm ?= wasm --include-path=\`pwd\`/pkg/contrib/wasmtime/crates/c-api/include --lib-path=/usr/lib/\$$(dpkg-architecture -q DEB_HOST_MULTIARCH)/
INSTALL_wasm ?= wasm-install
RUN_wasm ?= /bin/true
+BUILDDEPS_wasm ?=
MODULE_PREBUILD_wasm ?= $(MODULE_PREBUILD_wasm_common) \\\n \ \ \ \&\& $(MODULE_PREBUILD_wasmtime)
VERSIONS_wasm_wasi_component ?=
@@ -87,10 +96,11 @@ CONTAINER_wasm_wasi_component ?= debian:$(VARIANT)-slim
CONFIGURE_wasm_wasi_component ?= wasm-wasi-component
INSTALL_wasm_wasi_component ?= wasm-wasi-component-install
RUN_wasm_wasi_component ?= /bin/true
+BUILDDEPS_wasm_wasi_component ?= libclang-dev
MODULE_PREBUILD_wasm_wasi_component ?= $(MODULE_PREBUILD_wasm_common)
define MODULE_PREBUILD_wasm_common
-export RUST_VERSION=1.71.0 \\\n \
+export RUST_VERSION=1.76.0 \\\n \
\ \ \ \&\& export RUSTUP_HOME=/usr/src/unit/rustup \\\n \
\ \ \ \&\& export CARGO_HOME=/usr/src/unit/cargo \\\n \
\ \ \ \&\& export PATH=/usr/src/unit/cargo/bin:\$$PATH \\\n \
@@ -132,6 +142,7 @@ Dockerfile.%: ../../version template.Dockerfile
-e 's,@@VERSION@@,$(VERSION),g' \
-e 's,@@PATCHLEVEL@@,$(PATCHLEVEL),g' \
-e 's,@@CONTAINER@@,$(CONTAINER_$*),g' \
+ -e 's,@@BUILDDEPS@@,$(BUILDDEPS_$(call modname, $*)),g' \
-e 's,@@CONFIGURE@@,$(CONFIGURE_$(call modname, $*)),g' \
-e 's,@@INSTALL@@,$(INSTALL_$(call modname, $*)),g' \
-e 's,@@RUN@@,$(RUN_$(call modname, $*)),g' \
diff --git a/pkg/docker/template.Dockerfile b/pkg/docker/template.Dockerfile
index edf9ba75..80484f31 100644
--- a/pkg/docker/template.Dockerfile
+++ b/pkg/docker/template.Dockerfile
@@ -11,7 +11,7 @@ LABEL org.opencontainers.image.version="@@VERSION@@"
RUN set -ex \
&& savedAptMark="$(apt-mark showmanual)" \
&& apt-get update \
- && apt-get install --no-install-recommends --no-install-suggests -y ca-certificates git build-essential libssl-dev libpcre2-dev curl pkg-config \
+ && apt-get install --no-install-recommends --no-install-suggests -y ca-certificates git build-essential libssl-dev libpcre2-dev curl pkg-config @@BUILDDEPS@@ \
&& mkdir -p /usr/lib/unit/modules /usr/lib/unit/debug-modules \
&& mkdir -p /usr/src/unit \
&& cd /usr/src/unit \
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment