Skip to content

Instantly share code, notes, and snippets.

@takuto-h
Last active June 23, 2022 06:42
Show Gist options
  • Save takuto-h/c98543ad84c6ffdc5cfec42e5ebe3b91 to your computer and use it in GitHub Desktop.
Save takuto-h/c98543ad84c6ffdc5cfec42e5ebe3b91 to your computer and use it in GitHub Desktop.
Use node-gyp with node:*-slim
FROM node:10.15.1-slim
COPY ./package.json ./yarn.lock /app/
# Install dependencies for node-gyp
# https://github.com/nodejs/node-gyp#on-unix
RUN buildDeps='g++ make python' \
&& apt-get update \
&& apt-get install -y --no-install-recommends $buildDeps \
&& cd /app \
&& yarn install --frozen-lockfile \
&& yarn cache clean \
&& apt-get remove -y --purge --auto-remove $buildDeps \
&& rm -rf /var/lib/apt/lists/* /tmp/* /root/.node-gyp /usr/local/lib/node_modules/npm/node_modules/node-gyp
COPY ./test.mjs /app/
ENTRYPOINT ["node", "--experimental-modules", "--no-warnings", "/app/test.mjs"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment