diff --git a/src/core/build.mk b/src/core/build.mk index a1f434c..ae79d15 100644 --- a/src/core/build.mk +++ b/src/core/build.mk @@ -4,6 +4,7 @@ core: \ out/go.tgz \ out/python.tgz \ out/perl.tgz \ + out/nodejs.tgz \ out/gcc.tgz \ out/llvm.tgz @@ -137,6 +138,26 @@ out/python.tgz: \ out/musl.tgz $(call build,core,python) +out/nodejs.tgz: \ + out/gcc.tgz \ + out/busybox.tgz \ + out/openssl.tgz \ + out/python.tgz \ + out/ninja.tgz \ + out/make.tgz \ + out/musl.tgz + $(call build,core,nodejs) + +out/npm.tgz: \ + out/gcc.tgz \ + out/busybox.tgz \ + out/openssl.tgz \ + out/python.tgz \ + out/ninja.tgz \ + out/make.tgz \ + out/musl.tgz + $(call build,core,nodejs) + out/ninja.tgz: \ out/busybox.tgz \ out/gcc.tgz \ diff --git a/src/core/nodejs/Dockerfile b/src/core/nodejs/Dockerfile new file mode 100644 index 0000000..cfaba46 --- /dev/null +++ b/src/core/nodejs/Dockerfile @@ -0,0 +1,50 @@ +ARG REGISTRY=local +FROM ${REGISTRY}/busybox as busybox +FROM ${REGISTRY}/gcc as gcc +FROM ${REGISTRY}/musl as musl +FROM ${REGISTRY}/openssl as openssl +FROM ${REGISTRY}/python as python +FROM ${REGISTRY}/ninja as ninja +FROM ${REGISTRY}/openssl as openssl +FROM ${REGISTRY}/make as make + +FROM busybox as base +ENV VERSION=20.11.0 +ENV SRC_FILE=node-v${VERSION}.tar.gz +ENV SRC_SITE=https://nodejs.org/dist +ENV SRC_HASH=9884b22d88554d65025352ba7e4cb20f5d17a939231bea41a7894c0344fab1bf +COPY --from=musl . / +COPY --from=gcc . / +COPY --from=ninja . / +COPY --from=python . / +COPY --from=openssl . / + +FROM base as fetch +RUN wget --no-check-certificate ${SRC_SITE}/v${VERSION}/${SRC_FILE} +RUN echo "${SRC_HASH} ${SRC_FILE}" | sha256sum -c + +FROM fetch as build +RUN tar -xzf ${SRC_FILE} +WORKDIR build +RUN set -eux; \ + ../node-v${VERSION}/configure \ + --prefix=/usr \ + --ninja \ + --enable-lto \ + --openssl-use-def-ca-store \ + --without-corepack \ + --without-npm; \ + make BUILDTYPE=Release + +FROM build as install +USER 0:0 +COPY --from=musl /lib/* /rootfs/lib/ +RUN set -eux; \ + make PREFIX=/rootfs install; \ + find /rootfs -exec touch -hcd "@0" "{}" + + +FROM scratch as package +COPY --from=install /rootfs / +USER 100:100 +ENTRYPOINT ["/usr/bin/node"] +CMD ["--version"]