Skip to content

Commit

Permalink
perf(Dockerfile): speed up build (DIYgod#10621)
Browse files Browse the repository at this point in the history
Signed-off-by: Rongrong <i@rong.moe>

Signed-off-by: Rongrong <i@rong.moe>
  • Loading branch information
Rongronggg9 authored Aug 26, 2022
1 parent 605b14c commit 17fa8f5
Showing 1 changed file with 4 additions and 16 deletions.
20 changes: 4 additions & 16 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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 && \
Expand Down

0 comments on commit 17fa8f5

Please sign in to comment.