Skip to content

Instantly share code, notes, and snippets.

@kojira
Created January 2, 2022 06:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kojira/67b9a04bd69a119c3bdc09ff461833dc to your computer and use it in GitHub Desktop.
Save kojira/67b9a04bd69a119c3bdc09ff461833dc to your computer and use it in GitHub Desktop.
M1のDockerでplatformがarm64になった時にnodeのcanvasのインストール失敗するのに対応したDockerfile
FROM node:16-buster-slim
RUN apt-get update && \
apt-get -y install locales && \
localedef -f UTF-8 -i ja_JP ja_JP.UTF-8
ENV LANG ja_JP.UTF-8
ENV LANGUAGE ja_JP:ja
ENV LC_ALL ja_JP.UTF-8
ENV TZ JST-9
ENV TERM xterm
ENV HOST 0.0.0.0
RUN apt-get update && \
apt-get install -y vim less
RUN apt-get update && \
apt-get install -y curl openjdk-11-jre-headless fonts-noto-cjk
RUN npm install -g firebase-tools
RUN apt-get update && \
apt-get install -y build-essential libpixman-1-dev libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev
WORKDIR /app
RUN dpkgArch="$(dpkg --print-architecture)"; \
case "$dpkgArch" in \
arm64) export PKG_CONFIG_PATH="/usr/lib/aarch64-linux-gnu/pkgconfig/"; \
npm install --build-from-source canvas ;; \
esac;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment