From 501abc2fb1eb5180122c136c0f8480ffe5012917 Mon Sep 17 00:00:00 2001 From: Joshua Gottlieb Date: Sat, 26 Oct 2024 20:42:47 -0500 Subject: [PATCH] dockerfile improvements for smaller image --- Dockerfile | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 5ae6675..60b6d23 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,8 +2,17 @@ FROM python:3.11.3-slim AS build ENV DEBIAN_FRONTEND=noninteractive - -RUN apt update -y && apt install -y git +# Build dummy packages to skip installing them and their dependencies -- Copied from FlareSolverr +RUN apt update -y && apt install -y git \ + && apt-get install -y --no-install-recommends equivs \ + && equivs-control libgl1-mesa-dri \ + && printf 'Section: misc\nPriority: optional\nStandards-Version: 3.9.2\nPackage: libgl1-mesa-dri\nVersion: 99.0.0\nDescription: Dummy package for libgl1-mesa-dri\n' >> libgl1-mesa-dri \ + && equivs-build libgl1-mesa-dri \ + && mv libgl1-mesa-dri_*.deb /libgl1-mesa-dri.deb \ + && equivs-control adwaita-icon-theme \ + && printf 'Section: misc\nPriority: optional\nStandards-Version: 3.9.2\nPackage: adwaita-icon-theme\nVersion: 99.0.0\nDescription: Dummy package for adwaita-icon-theme\n' >> adwaita-icon-theme \ + && equivs-build adwaita-icon-theme \ + && mv adwaita-icon-theme_*.deb /adwaita-icon-theme.deb RUN python3 -m venv /venv ENV PATH=/venv/bin:$PATH @@ -19,7 +28,11 @@ ENV DEBIAN_FRONTEND=noninteractive WORKDIR /opt/SassBot -RUN apt update -y && apt install -y --no-install-recommends chromium xvfb +RUN apt update -y && apt install -y --no-install-recommends chromium xvfb \ + # Remove temporary files and hardware decoding libraries -- Copied from FlareSolverr + && rm -rf /var/lib/apt/lists/* \ + && rm -f /usr/lib/x86_64-linux-gnu/libmfxhw* \ + && rm -f /usr/lib/x86_64-linux-gnu/mfx/* COPY --from=build /venv /venv ENV PATH=/venv/bin:$PATH