Skip to content

Commit

Permalink
Simplified Dockerfile with a little reduced size (robusta-dev#559)
Browse files Browse the repository at this point in the history
* Simplified Dockerfile with a little reduced size

* Removed ruamel.yaml.clib and GCC
  • Loading branch information
pavangudiwada authored Oct 11, 2022
1 parent 4f67874 commit 4b56be2
Showing 1 changed file with 9 additions and 24 deletions.
33 changes: 9 additions & 24 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4b56be2

Please sign in to comment.