From bc5f1f2d00eba08ba877d16ede949e9d226b562d Mon Sep 17 00:00:00 2001 From: Tingluo Huang Date: Thu, 21 Oct 2021 14:01:07 -0400 Subject: [PATCH] Create Dockerfile --- Dockerfile | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..4006d9f --- /dev/null +++ b/Dockerfile @@ -0,0 +1,21 @@ +ARG NodeVersion +FROM alpine +RUN mkdir -p /usr/src/app +WORKDIR /usr/src/app + +# install dependency +RUN apk add --no-cache libstdc++ +RUN apk add --no-cache --virtual .build-deps binutils-gold curl g++ gcc gnupg libgcc linux-headers make python + +# donwload and compile node from source code. +RUN wget https://nodejs.org/dist/$NodeVersion/node-$NodeVersion.tar.gz && tar -zxvf node-$NodeVersion.tar.gz +RUN cd node-$NodeVersion && ./configure --partly-static && make -j$(getconf _NPROCESSORS_ONLN) + +# create and copy tar.gz into /node_staging +RUN mkdir -p /usr/src/bin +RUN cp /usr/src/app/out/Release/node /usr/src/bin +RUN tar -czvf node-$NodeVersion-alpine.tar.gz /usr/src/bin +RUN cp ./node-$NodeVersion-alpine.tar.gz /node_staging + +# copy the tar.gz into the mapped in volume +CMD ["cp", "/node_staging", "/node_output"]