From 846cebe9ff63befc4cc8b331f3de46598b349291 Mon Sep 17 00:00:00 2001 From: Matt Cengia Date: Tue, 14 Jul 2020 21:37:16 +1000 Subject: [PATCH 1/3] Add build dependencies for 'canvas' to Dockerfile When building the Docker image on amd64, canvas can be installed from a pre-built binary. When building on an another architecture, however, such as arm (e.g. on a Raspberry Pi), these binaries need to be built locally, as per https://www.npmjs.com/package/canvas#compiling. These added dependencies facilitate this. See also, issue #14400. Signed-off-by: Matt Cengia --- Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 8f584b81..cff56f5f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,7 +9,8 @@ ARG REACT_SDK_BRANCH="master" ARG JS_SDK_REPO="https://github.com/matrix-org/matrix-js-sdk.git" ARG JS_SDK_BRANCH="master" -RUN apt-get update && apt-get install -y git dos2unix +RUN apt-get update && apt-get install -y git dos2unix \ + build-essential libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev WORKDIR /src From fb79373a6d54d710ee5473081626844658bcbacf Mon Sep 17 00:00:00 2001 From: Matt Cengia Date: Thu, 16 Jul 2020 15:54:26 +1000 Subject: [PATCH 2/3] Bump node build version When trying to build the Docker image, I kept receiving an out-of-memory error from Webpack. This issue is apparently explained at https://github.com/webpack/webpack/issues/1914. Several comments in the issue suggested using Node 12 or above. Doing so resolved this issue for me. Signed-off-by: Matt Cengia --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index cff56f5f..98d59e73 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # Builder -FROM node:10 as builder +FROM node:12 as builder # Support custom branches of the react-sdk and js-sdk. This also helps us build # images of riot-web develop. From 86185e8186ee7737ee2e47aba477ebc06f534315 Mon Sep 17 00:00:00 2001 From: Matt Cengia Date: Fri, 31 Jul 2020 22:25:21 +1000 Subject: [PATCH 3/3] Document packages for installing Canvas via Docker Signed-off-by: Matt Cengia --- Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Dockerfile b/Dockerfile index 98d59e73..92d35e7d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,6 +10,8 @@ ARG JS_SDK_REPO="https://github.com/matrix-org/matrix-js-sdk.git" ARG JS_SDK_BRANCH="master" RUN apt-get update && apt-get install -y git dos2unix \ +# These packages are required for building Canvas on architectures like Arm +# See https://www.npmjs.com/package/canvas#compiling build-essential libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev WORKDIR /src