Skip to content

Commit

Permalink
Optimize Dockerfiles by Disabling pip Cache
Browse files Browse the repository at this point in the history
  • Loading branch information
amdadulbari authored Jul 3, 2023
1 parent 9eb8bfa commit 3794f87
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions dev.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ RUN apt-get install -y --no-install-recommends --yes \
dpkg -i wkhtmltox_0.12.6.1-2.bullseye_amd64.deb && \
rm -rf wkhtmltox_0.12.6.1-2.bullseye_amd64.deb && \
python3 -m venv /venv && \
/venv/bin/pip install --upgrade pip
/venv/bin/pip install --upgrade pip --no-cache-dir

COPY requirements.txt /requirements.txt
RUN /venv/bin/pip install -r /requirements.txt
RUN /venv/bin/pip install --no-cache-dir -r /requirements.txt

RUN /venv/bin/pip install pylint flake8 bandit
ENV PATH="/venv/bin:${PATH}"
Expand Down
4 changes: 2 additions & 2 deletions prod.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ FROM python:slim-bullseye AS builder
RUN apt-get update && \
apt-get install --no-install-suggests --no-install-recommends --yes python3-venv gcc libpython3-dev gtk+3.0 && \
python3 -m venv /venv && \
/venv/bin/pip install --upgrade pip
/venv/bin/pip install --upgrade pip --no-cache-dir

FROM builder AS builder-venv
COPY requirements.txt /requirements.txt
RUN /venv/bin/pip install --disable-pip-version-check -r /requirements.txt
RUN /venv/bin/pip install --disable-pip-version-check --no-cache-dir -r /requirements.txt

FROM python:slim-bullseye AS runner
RUN apt-get update && \
Expand Down

0 comments on commit 3794f87

Please sign in to comment.