From 4b56be272476617743cf442c77d060d26796ab00 Mon Sep 17 00:00:00 2001 From: Pavan Gudiwada Date: Tue, 11 Oct 2022 23:18:13 +0530 Subject: [PATCH] Simplified Dockerfile with a little reduced size (#559) * Simplified Dockerfile with a little reduced size * Removed ruamel.yaml.clib and GCC --- Dockerfile | 33 +++++++++------------------------ 1 file changed, 9 insertions(+), 24 deletions(-) diff --git a/Dockerfile b/Dockerfile index d056bee32..ccff9be77 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,38 +3,23 @@ FROM python:3.9-slim RUN apt-get update \ && dpkg --add-architecture arm64 \ && apt-get install -y --no-install-recommends git ssh socat wget curl libcairo2 python3-dev libffi-dev socat \ - && apt-get purge -y --auto-remove \ + && pip3 install --no-cache-dir --upgrade pip \ && rm -rf /var/lib/apt/lists/* -# install a custom version of socat with readline enabled -# disabled because of an issue with the libreadline7 dependency -#RUN wget https://launchpad.net/~ionel-mc/+archive/ubuntu/socat/+build/15532886/+files/socat_1.7.3.2-2ubuntu2ionelmc2~ppa1_amd64.deb -#RUN dpkg -i socat_1.7.3.2-2ubuntu2ionelmc2~ppa1_amd64.deb -ENV ENV_TYPE=DEV +ENV ENV_TYPE=DEV -# we install the project requirements and install the app in separate stages to optimize docker layer caching -RUN mkdir /app -RUN pip3 install --no-cache-dir --upgrade pip +RUN mkdir /app RUN curl -sSL https://install.python-poetry.org | python3 - -RUN /root/.local/bin/poetry config virtualenvs.create false -COPY pyproject.toml poetry.lock /app/ +RUN /root/.local/bin/poetry config virtualenvs.create false WORKDIR /app -# Install gcc to compile rumal.yaml.clib, wheel is missing. -RUN apt-get update \ - && apt-get install -y --no-install-recommends gcc \ - && pip3 install --no-cache-dir ruamel.yaml.clib \ - && apt-get purge -y --auto-remove gcc \ - && rm -rf /var/lib/apt/lists/* - -RUN /root/.local/bin/poetry install --no-root --extras "all" - +# we install the project requirements and install the app in separate stages to optimize docker layer caching +COPY pyproject.toml poetry.lock /app/ +RUN /root/.local/bin/poetry install --no-root --no-dev --extras "all" COPY src/ /app/src - -RUN pip3 install --no-cache-dir . - +RUN /root/.local/bin/poetry install --no-dev --extras "all" + COPY playbooks/ /etc/robusta/playbooks/defaults - RUN python3 -m pip install --no-cache-dir /etc/robusta/playbooks/defaults # -u disables stdout buffering https://stackoverflow.com/questions/107705/disable-output-buffering