feat: use ninja and shared libs for nodejs
This commit is contained in:
parent
d12f1b8a02
commit
bd7ce59caa
6 changed files with 215 additions and 3 deletions
|
@ -35,8 +35,13 @@ RUN --network=none <<-EOF
|
|||
EOF
|
||||
|
||||
FROM build AS install
|
||||
RUN DESTDIR=/rootfs cmake --install build
|
||||
RUN find /rootfs -exec touch -hcd "@0" "{}" +
|
||||
RUN <<-EOF
|
||||
set -eux
|
||||
DESTDIR=/rootfs cmake --install build
|
||||
for file in common dec enc; do
|
||||
install -D -m 755 build/libbrotli$file.a /rootfs/usr/lib/
|
||||
done
|
||||
EOF
|
||||
|
||||
FROM stagex/filesystem AS package
|
||||
COPY --from=install /rootfs/. /
|
||||
|
|
35
packages/c-ares/Containerfile
Normal file
35
packages/c-ares/Containerfile
Normal file
|
@ -0,0 +1,35 @@
|
|||
FROM scratch AS base
|
||||
ENV VERSION=1.33.1
|
||||
ENV SRC_HASH=06869824094745872fa26efd4c48e622b9bd82a89ef0ce693dc682a23604f415
|
||||
ENV SRC_FILE=c-ares-${VERSION}.tar.gz
|
||||
ENV SRC_SITE=https://github.com/c-ares/c-ares/releases/download/v${VERSION}/${SRC_FILE}
|
||||
|
||||
FROM base AS fetch
|
||||
ADD --checksum=sha256:${SRC_HASH} ${SRC_SITE} .
|
||||
|
||||
FROM fetch AS build
|
||||
COPY --from=stagex/busybox . /
|
||||
COPY --from=stagex/binutils . /
|
||||
COPY --from=stagex/musl . /
|
||||
COPY --from=stagex/make . /
|
||||
COPY --from=stagex/gcc . /
|
||||
|
||||
RUN --network=none tar -xf ${SRC_FILE}
|
||||
WORKDIR c-ares-${VERSION}
|
||||
RUN --network=none <<EOF
|
||||
set -eux
|
||||
./configure \
|
||||
--build=x86_64-linux-musl \
|
||||
--host=x86_64-linux-musl \
|
||||
--prefix=/usr \
|
||||
--mandir=/usr/share/man \
|
||||
--infodir=/usr/share/info \
|
||||
--enable-shared
|
||||
make -j "$(nproc)"
|
||||
EOF
|
||||
|
||||
FROM build AS install
|
||||
RUN --network=none make DESTDIR=/rootfs install
|
||||
|
||||
FROM stagex/filesystem AS package
|
||||
COPY --from=install /rootfs/. /
|
44
packages/libev/Containerfile
Normal file
44
packages/libev/Containerfile
Normal file
|
@ -0,0 +1,44 @@
|
|||
FROM scratch AS base
|
||||
ENV VERSION=4.33
|
||||
ENV SRC_HASH=507eb7b8d1015fbec5b935f34ebed15bf346bed04a11ab82b8eee848c4205aea
|
||||
ENV SRC_FILE=libev-${VERSION}.tar.gz
|
||||
ENV SRC_SITE=http://dist.schmorp.de/libev/Attic/${SRC_FILE}
|
||||
|
||||
FROM base AS fetch
|
||||
ADD --checksum=sha256:${SRC_HASH} ${SRC_SITE} .
|
||||
|
||||
FROM fetch AS build
|
||||
COPY --from=stagex/busybox . /
|
||||
COPY --from=stagex/binutils . /
|
||||
COPY --from=stagex/musl . /
|
||||
COPY --from=stagex/make . /
|
||||
COPY --from=stagex/gcc . /
|
||||
COPY --from=stagex/perl . /
|
||||
COPY --from=stagex/autoconf . /
|
||||
COPY --from=stagex/automake . /
|
||||
COPY --from=stagex/libtool . /
|
||||
COPY --from=stagex/m4 . /
|
||||
|
||||
RUN --network=none tar -xf ${SRC_FILE}
|
||||
WORKDIR libev-${VERSION}
|
||||
ENV SOURCE_DATE_EPOCH=1
|
||||
RUN --network=none <<EOF
|
||||
set -eux
|
||||
libtoolize --force
|
||||
aclocal -I m4
|
||||
autoheader
|
||||
autoconf
|
||||
automake --add-missing
|
||||
./configure \
|
||||
--build=x86_64-linux-musl \
|
||||
--host=x86_64-linux-musl \
|
||||
--prefix=/usr \
|
||||
--sysconfdir=/etc
|
||||
make -j "$(nproc)"
|
||||
EOF
|
||||
|
||||
FROM build AS install
|
||||
RUN --network=none make DESTDIR=/rootfs install
|
||||
|
||||
FROM stagex/filesystem AS package
|
||||
COPY --from=install /rootfs/. /
|
59
packages/libnghttp2/Containerfile
Normal file
59
packages/libnghttp2/Containerfile
Normal file
|
@ -0,0 +1,59 @@
|
|||
FROM scratch AS base
|
||||
ENV VERSION=1.62.1
|
||||
ENV SRC_HASH=d0b0b9d00500ee4aa3bfcac00145d3b1ef372fd301c35bff96cf019c739db1b4
|
||||
ENV SRC_FILE=nghttp2-${VERSION}.tar.gz
|
||||
ENV SRC_SITE=https://github.com/nghttp2/nghttp2/releases/download/v${VERSION}/${SRC_FILE}
|
||||
|
||||
FROM base AS fetch
|
||||
ADD --checksum=sha256:${SRC_HASH} ${SRC_SITE} .
|
||||
|
||||
FROM fetch AS build
|
||||
COPY --from=stagex/busybox . /
|
||||
COPY --from=stagex/binutils . /
|
||||
COPY --from=stagex/musl . /
|
||||
COPY --from=stagex/make . /
|
||||
COPY --from=stagex/gcc . /
|
||||
COPY --from=stagex/zlib . /
|
||||
COPY --from=stagex/pkgconf . /
|
||||
COPY --from=stagex/openssl . /
|
||||
COPY --from=stagex/libev . /
|
||||
COPY --from=stagex/c-ares . /
|
||||
|
||||
RUN --network=none tar -xf ${SRC_FILE}
|
||||
WORKDIR nghttp2-${VERSION}
|
||||
RUN --network=none <<EOF
|
||||
set -eux
|
||||
./configure \
|
||||
--build=x86_64-linux-musl \
|
||||
--host=x86_64-linux-musl \
|
||||
--prefix=/usr \
|
||||
--sysconfdir=/etc \
|
||||
--mandir=/usr/share/man \
|
||||
--infodir=/usr/share/info \
|
||||
--localstatedir=/var \
|
||||
--disable-python-bindings \
|
||||
--enable-lib-only \
|
||||
--with-libcares \
|
||||
--with-libev \
|
||||
--with-openssl \
|
||||
--disable-examples \
|
||||
--disable-http3 \
|
||||
--disable-werror \
|
||||
--without-jansson \
|
||||
--without-jemalloc \
|
||||
--without-libbpf \
|
||||
--without-libnghttp3 \
|
||||
--without-libngtcp2 \
|
||||
--without-libxml2 \
|
||||
--without-mruby \
|
||||
--without-neverbleed \
|
||||
--without-systemd \
|
||||
--without-cunit
|
||||
make -j "$(nproc)"
|
||||
EOF
|
||||
|
||||
FROM build AS install
|
||||
RUN --network=none make DESTDIR=/rootfs install
|
||||
|
||||
FROM stagex/filesystem AS package
|
||||
COPY --from=install /rootfs/. /
|
|
@ -18,7 +18,12 @@ COPY --from=stagex/python . /
|
|||
COPY --from=stagex/bzip2 . /
|
||||
COPY --from=stagex/ninja . /
|
||||
COPY --from=stagex/zlib . /
|
||||
COPY --from=stagex/icu . /
|
||||
COPY --from=stagex/linux-headers . /
|
||||
COPY --from=stagex/libnghttp2 . /
|
||||
COPY --from=stagex/brotli . /
|
||||
COPY --from=stagex/c-ares . /
|
||||
COPY --from=stagex/pkgconf . /
|
||||
RUN tar -xf ${SRC_FILE}
|
||||
WORKDIR node-v${VERSION}
|
||||
ENV SOURCE_DATE_EPOCH=1
|
||||
|
@ -26,16 +31,29 @@ ENV LDFLAGS=" \
|
|||
-Wl,-O1 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro \
|
||||
-Wl,-z,now -Wl,-z,pack-relative-relocs"
|
||||
ENV CFLAGS=" \
|
||||
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 \
|
||||
-march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions \
|
||||
-Wp,-D_FORTIFY_SOURCE=3 -Wformat -Werror=format-security \
|
||||
-fstack-clash-protection -fcf-protection \
|
||||
-fno-omit-frame-pointer -mno-omit-leaf-frame-pointer"
|
||||
ENV CXXFLAGS="$CFLAGS -Wp,-D_GLIBCXX_ASSERTIONS"
|
||||
ENV CPPFLAGS="$CXXFLAGS"
|
||||
ENV LTOFLAGS="-flto=auto"
|
||||
|
||||
RUN --network=none <<-EOF
|
||||
set -eux
|
||||
python configure.py
|
||||
python configure.py \
|
||||
--prefix=/usr \
|
||||
--ninja \
|
||||
--shared-zlib \
|
||||
--shared-nghttp2 \
|
||||
--shared-openssl \
|
||||
--shared-cares \
|
||||
--shared-brotli \
|
||||
--without-npm \
|
||||
--without-corepack \
|
||||
--with-icu-default-data-dir=$(icu-config --icudatadir) \
|
||||
--openssl-use-def-ca-store
|
||||
make BUILDTYPE=Release
|
||||
EOF
|
||||
|
||||
|
|
|
@ -325,6 +325,18 @@ out/bzip2/index.json: \
|
|||
out/musl/index.json
|
||||
$(call build,bzip2)
|
||||
|
||||
.PHONY: c-ares
|
||||
c-ares: out/c-ares/index.json
|
||||
out/c-ares/index.json: \
|
||||
packages/c-ares/Containerfile \
|
||||
out/binutils/index.json \
|
||||
out/busybox/index.json \
|
||||
out/filesystem/index.json \
|
||||
out/gcc/index.json \
|
||||
out/make/index.json \
|
||||
out/musl/index.json
|
||||
$(call build,c-ares)
|
||||
|
||||
.PHONY: ca-certificates
|
||||
ca-certificates: out/ca-certificates/index.json
|
||||
out/ca-certificates/index.json: \
|
||||
|
@ -1491,6 +1503,23 @@ out/libedit/index.json: \
|
|||
out/perl/index.json
|
||||
$(call build,libedit)
|
||||
|
||||
.PHONY: libev
|
||||
libev: out/libev/index.json
|
||||
out/libev/index.json: \
|
||||
packages/libev/Containerfile \
|
||||
out/autoconf/index.json \
|
||||
out/automake/index.json \
|
||||
out/binutils/index.json \
|
||||
out/busybox/index.json \
|
||||
out/filesystem/index.json \
|
||||
out/gcc/index.json \
|
||||
out/libtool/index.json \
|
||||
out/m4/index.json \
|
||||
out/make/index.json \
|
||||
out/musl/index.json \
|
||||
out/perl/index.json
|
||||
$(call build,libev)
|
||||
|
||||
.PHONY: libevent
|
||||
libevent: out/libevent/index.json
|
||||
out/libevent/index.json: \
|
||||
|
@ -1621,6 +1650,23 @@ out/libnftnl/index.json: \
|
|||
out/pkgconf/index.json
|
||||
$(call build,libnftnl)
|
||||
|
||||
.PHONY: libnghttp2
|
||||
libnghttp2: out/libnghttp2/index.json
|
||||
out/libnghttp2/index.json: \
|
||||
packages/libnghttp2/Containerfile \
|
||||
out/binutils/index.json \
|
||||
out/busybox/index.json \
|
||||
out/c-ares/index.json \
|
||||
out/filesystem/index.json \
|
||||
out/gcc/index.json \
|
||||
out/libev/index.json \
|
||||
out/make/index.json \
|
||||
out/musl/index.json \
|
||||
out/openssl/index.json \
|
||||
out/pkgconf/index.json \
|
||||
out/zlib/index.json
|
||||
$(call build,libnghttp2)
|
||||
|
||||
.PHONY: libqrencode
|
||||
libqrencode: out/libqrencode/index.json
|
||||
out/libqrencode/index.json: \
|
||||
|
@ -2244,15 +2290,20 @@ nodejs: out/nodejs/index.json
|
|||
out/nodejs/index.json: \
|
||||
packages/nodejs/Containerfile \
|
||||
out/binutils/index.json \
|
||||
out/brotli/index.json \
|
||||
out/busybox/index.json \
|
||||
out/bzip2/index.json \
|
||||
out/c-ares/index.json \
|
||||
out/filesystem/index.json \
|
||||
out/gcc/index.json \
|
||||
out/icu/index.json \
|
||||
out/libnghttp2/index.json \
|
||||
out/linux-headers/index.json \
|
||||
out/make/index.json \
|
||||
out/musl/index.json \
|
||||
out/ninja/index.json \
|
||||
out/openssl/index.json \
|
||||
out/pkgconf/index.json \
|
||||
out/python/index.json \
|
||||
out/zlib/index.json
|
||||
$(call build,nodejs)
|
||||
|
|
Loading…
Reference in a new issue