Skip to content

Commit e516d91

Browse files
committed
Docker: introduced a "module prebuild" step.
It's now used to install node-gyp on nodejs images. Starting from node:20, they no longer ship node-gyp that we require to build the modules with, so we need to install it manually. Fixes #908.
1 parent ffc6e6b commit e516d91

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

pkg/docker/Makefile

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,55 +17,63 @@ CONTAINER_minimal ?= debian:$(VARIANT)-slim
1717
CONFIGURE_minimal ?=
1818
INSTALL_minimal ?= version
1919
RUN_minimal ?= /bin/true
20+
MODULE_PREBUILD_minimal ?= /bin/true
2021

2122
VERSIONS_go ?= 1.20
2223
VARIANT_go ?= $(VARIANT)
2324
$(foreach goversion, $(VERSIONS_go), $(eval CONTAINER_go$(goversion) = golang:$(goversion)-$(VARIANT_go)))
2425
CONFIGURE_go ?= go --go-path=$$GOPATH
2526
INSTALL_go ?= go-install-src libunit-install
2627
RUN_go ?= /bin/true
28+
MODULE_PREBUILD_go ?= /bin/true
2729

2830
VERSIONS_jsc ?= 11
2931
VARIANT_jsc ?= jammy
3032
$(foreach jscversion, $(VERSIONS_jsc), $(eval CONTAINER_jsc$(jscversion) = eclipse-temurin:$(jscversion)-jdk-$(VARIANT_jsc)))
3133
CONFIGURE_jsc ?= java --jars=/usr/share/unit-jsc-common/
3234
INSTALL_jsc ?= java-shared-install java-install
3335
RUN_jsc ?= /bin/true
36+
MODULE_PREBUILD_jsc ?= /bin/true
3437

3538
VERSIONS_node ?= 18
3639
VARIANT_node ?= $(VARIANT)
3740
$(foreach nodeversion, $(VERSIONS_node), $(eval CONTAINER_node$(nodeversion) = node:$(nodeversion)-$(VARIANT_node)))
38-
CONFIGURE_node ?= nodejs --node-gyp=/usr/local/lib/node_modules/npm/bin/node-gyp-bin/node-gyp
41+
CONFIGURE_node ?= nodejs --node-gyp=/usr/local/bin/node-gyp
3942
INSTALL_node ?= node node-install libunit-install
4043
RUN_node ?= /bin/true
44+
MODULE_PREBUILD_node ?= npm -g install node-gyp
4145

4246
VERSIONS_perl ?= 5.36
4347
VARIANT_perl ?= $(VARIANT)
4448
$(foreach perlversion, $(VERSIONS_perl), $(eval CONTAINER_perl$(perlversion) = perl:$(perlversion)-$(VARIANT_perl)))
4549
CONFIGURE_perl ?= perl
4650
INSTALL_perl ?= perl-install
4751
RUN_perl ?= /bin/true
52+
MODULE_PREBUILD_perl ?= /bin/true
4853

4954
VERSIONS_php ?= 8.2
5055
VARIANT_php ?= cli-$(VARIANT)
5156
$(foreach phpversion, $(VERSIONS_php), $(eval CONTAINER_php$(phpversion) = php:$(phpversion)-$(VARIANT_php)))
5257
CONFIGURE_php ?= php
5358
INSTALL_php ?= php-install
5459
RUN_php ?= ldconfig
60+
MODULE_PREBUILD_php ?= /bin/true
5561

5662
VERSIONS_python ?= 3.11
5763
VARIANT_python ?= $(VARIANT)
5864
$(foreach pythonversion, $(VERSIONS_python), $(eval CONTAINER_python$(pythonversion) = python:$(pythonversion)-$(VARIANT_python)))
5965
CONFIGURE_python ?= python --config=/usr/local/bin/python3-config
6066
INSTALL_python ?= python3-install
6167
RUN_python ?= /bin/true
68+
MODULE_PREBUILD_python ?= /bin/true
6269

6370
VERSIONS_ruby ?= 3.2
6471
VARIANT_ruby ?= $(VARIANT)
6572
$(foreach rubyversion, $(VERSIONS_ruby), $(eval CONTAINER_ruby$(rubyversion) = ruby:$(rubyversion)-$(VARIANT_ruby)))
6673
CONFIGURE_ruby ?= ruby
6774
INSTALL_ruby ?= ruby-install
6875
RUN_ruby ?= gem install rack
76+
MODULE_PREBUILD_ruby ?= /bin/true
6977

7078
default:
7179
@echo "valid targets: all build dockerfiles library clean"
@@ -86,6 +94,7 @@ Dockerfile.%: ../../version template.Dockerfile
8694
-e 's,@@CONFIGURE@@,$(CONFIGURE_$(call modname, $*)),g' \
8795
-e 's,@@INSTALL@@,$(INSTALL_$(call modname, $*)),g' \
8896
-e 's,@@RUN@@,$(RUN_$(call modname, $*)),g' \
97+
-e 's,@@MODULE_PREBUILD@@,$(MODULE_PREBUILD_$(call modname, $*)),g' \
8998
> $@
9099

91100
build-%: Dockerfile.%

pkg/docker/template.Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ RUN set -ex \
4343
&& make -j $NCPU unitd \
4444
&& install -pm755 build/sbin/unitd /usr/sbin/unitd \
4545
&& make clean \
46+
&& @@MODULE_PREBUILD@@ \
4647
&& ./configure $CONFIGURE_ARGS_MODULES --cc-opt="$CC_OPT" --modulesdir=/usr/lib/unit/debug-modules --debug \
4748
&& ./configure @@CONFIGURE@@ \
4849
&& make -j $NCPU @@INSTALL@@ \

0 commit comments

Comments
 (0)