From 17fa8f5f673b72f33e235d29194edf7a06647003 Mon Sep 17 00:00:00 2001 From: Rongrong Date: Fri, 26 Aug 2022 17:42:02 +0800 Subject: [PATCH] perf(Dockerfile): speed up build (#10621) Signed-off-by: Rongrong Signed-off-by: Rongrong --- Dockerfile | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/Dockerfile b/Dockerfile index c4aa75d830..af82c446bc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,28 +1,16 @@ -FROM node:16-bullseye-slim as dep-builder +FROM node:16-bullseye as dep-builder +# Here we use the non-slim image to provide build-time deps (compilers and python), thus no need to install later. +# This effectively speeds up qemu-based cross-build. -# bash has already been the default shell +# no longer needed #RUN ln -sf /bin/bash /bin/sh -# these deps are no longer needed since we use yarn instead of npm to install dependencies -# the installation of dumb-init has been moved to the app stage to improve concurrency and speed up builds on arm/arm64 -#RUN \ -# set -ex && \ -# apt-get update && \ -# apt-get install -yq --no-install-recommends \ -# libgconf-2-4 apt-transport-https git dumb-init python3 build-essential \ -# && \ -# rm -rf /var/lib/apt/lists/* - WORKDIR /app # place ARG statement before RUN statement which need it to avoid cache miss ARG USE_CHINA_NPM_REGISTRY=0 RUN \ set -ex && \ - apt-get update && \ - apt-get install -yq --no-install-recommends \ - build-essential python3 \ - ; \ if [ "$USE_CHINA_NPM_REGISTRY" = 1 ]; then \ echo 'use npm mirror' && \ npm config set registry https://registry.npmmirror.com && \