From e18a6e376cc6f4b0c818159bd83944e1ddd13f7f Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Thu, 12 Jan 2023 11:59:44 +0100 Subject: [PATCH] Use jemalloc in Docker builds (#85738) --- Dockerfile | 39 +++++++++++++++++++++++++++++++-------- 1 file changed, 31 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index 03bd9131ea0..b80e86fb33c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,22 +11,45 @@ WORKDIR /usr/src COPY requirements.txt homeassistant/ COPY homeassistant/package_constraints.txt homeassistant/homeassistant/ RUN \ - pip3 install --no-cache-dir --no-index --only-binary=:all: --find-links "${WHEELS_LINKS}" \ - -r homeassistant/requirements.txt --use-deprecated=legacy-resolver + pip3 install \ + --no-cache-dir \ + --no-index \ + --only-binary=:all: \ + --find-links "${WHEELS_LINKS}" \ + --use-deprecated=legacy-resolver \ + -r homeassistant/requirements.txt + COPY requirements_all.txt home_assistant_frontend-* homeassistant/ RUN \ if ls homeassistant/home_assistant_frontend*.whl 1> /dev/null 2>&1; then \ - pip3 install --no-cache-dir --no-index homeassistant/home_assistant_frontend-*.whl; \ + pip3 install \ + --no-cache-dir \ + --no-index \ + homeassistant/home_assistant_frontend-*.whl; \ fi \ - && pip3 install --no-cache-dir --no-index --only-binary=:all: --find-links "${WHEELS_LINKS}" \ - -r homeassistant/requirements_all.txt --use-deprecated=legacy-resolver + && \ + LD_PRELOAD="/usr/local/lib/libjemalloc.so.2" \ + MALLOC_CONF="background_thread:true,metadata_thp:auto,dirty_decay_ms:20000,muzzy_decay_ms:20000" \ + pip3 install \ + --no-cache-dir \ + --no-index \ + --only-binary=:all: \ + --find-links "${WHEELS_LINKS}" \ + --use-deprecated=legacy-resolver \ + -r homeassistant/requirements_all.txt ## Setup Home Assistant Core COPY . homeassistant/ RUN \ - pip3 install --no-cache-dir --no-index --only-binary=:all: --find-links "${WHEELS_LINKS}" \ - -e ./homeassistant --use-deprecated=legacy-resolver \ - && python3 -m compileall homeassistant/homeassistant + pip3 install \ + --no-cache-dir \ + --no-index \ + --only-binary=:all: \ + --find-links "${WHEELS_LINKS}" \ + --use-deprecated=legacy-resolver \ + -e ./homeassistant \ + && python3 -m compileall \ + homeassistant/homeassistant # Home Assistant S6-Overlay COPY rootfs /