From 27a5e4ec1d790efdfae1b773e845dfe47870fba0 Mon Sep 17 00:00:00 2001 From: Oliver Gugger Date: Wed, 9 Dec 2020 17:47:18 +0100 Subject: [PATCH] docker: fix yarn installation for ARM builds This commit fixes multiple problems that seem to only appear when building the docker images for ARM. --- Dockerfile | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 7beb7c1c..1a51dcd3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,13 +6,25 @@ FROM node:12.17.0-alpine as nodejsbuilder # master by default. ARG checkout="master" +# There seem to be multiple problems when using yarn for a build inside of a +# docker image: +# 1. For building and installing node-gyp, python is required. This seems to +# be missing from the NodeJS base image for ARM builds (or is just required +# when building for ARM?). +# 2. Because of a problem in the docker internal network on ARM, some TCP +# packages are being dropped and the yarn installation times out. This can +# be mitigated by switching to HTTP and increasing the network timeout. +# See https://github.com/yarnpkg/yarn/issues/5259 for more info. RUN apk add --no-cache --update alpine-sdk \ + python \ git \ && git clone https://github.com/lightninglabs/lightning-terminal /go/src/github.com/lightninglabs/lightning-terminal \ && cd /go/src/github.com/lightninglabs/lightning-terminal \ && git checkout $checkout \ && cd app \ - && yarn install \ + && npm config set registry "http://registry.npmjs.org" \ + && yarn config set registry "http://registry.npmjs.org" \ + && yarn install --frozen-lockfile --network-timeout 1000000 \ && yarn build # The first stage is already done and all static assets should now be generated