Skip to content

Instantly share code, notes, and snippets.

@lukaswilkeer
Last active October 8, 2021 09:58
Show Gist options
  • Save lukaswilkeer/b5b593a9fad3b1f882c0ba98f5f001ac to your computer and use it in GitHub Desktop.
Save lukaswilkeer/b5b593a9fad3b1f882c0ba98f5f001ac to your computer and use it in GitHub Desktop.
Node-addon hello wordl example
{
"targets": [{"target_name": "addon"}],
"sources": ["hello.cc"]
}
FROM ubuntu:latest
# wget and apt
RUN apt-get install -y apt-transport-https && apt-get update
RUN apt-get install -y build-essential
RUN apt-get install -y wget
RUN apt-get install -y xz-utils
RUN apt-get install -y zlib1g-dev
RUN apt-get install -y libbz2-dev
# installs python
RUN wget https://www.python.org/ftp/python/3.9.6/Python-3.9.6.tar.xz
RUN tar -xJf Python-3.9.6.tar.xz
RUN cd Python-3.9.6 && chmod +x configure && ./configure && make && make install
# installs nodejs
RUN wget https://nodejs.org/download/release/v16.10.0/node-v16.10.0.tar.gz
ENV VERSION=v16.10.0
ENV DISTRO=linux-x64
RUN mkdir -p /usr/local/lib/nodejs && tar -xf node-$VERSION.tar.gz -C /usr/local/lib/nodejs
RUN cd /usr/local/lib/nodejs/node-$VERSION && ls -la
RUN cd /usr/local/lib/nodejs/node-$VERSION && ./configure && make -j4 && make install
ENV PATH=/usr/local/lib/nodejs/node-$VERSION/bin:$PATH
# RUN mkdir /usr/lib/node && cp -r node-v16.10.0 /usr/lib/node
# RUN rm node-v16.10.0.tar.gz && rm -r node-v16.10.0
# build the application
COPY . .
#RUN rm package-lock.json
#RUN npm install node-gyp
#RUN npx node-gyp configure
#RUN npx node-gyp build
# CMD ["npm", "start"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment