Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

BLD: Decrease size of docker image #61430

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 12, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Decrease size of docker image
Combining RUN commands to minimise the number of layers and cleaning up the apt lists to reduce total size.
  • Loading branch information
huisman authored May 11, 2025
commit cfc299db266d476a03382f20932c832d8dfa3b7e
20 changes: 13 additions & 7 deletions 20 Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
FROM python:3.10.8
WORKDIR /home/pandas

RUN apt-get update && apt-get -y upgrade
RUN apt-get install -y build-essential bash-completion
RUN apt-get update && \
apt-get -y upgrade && \
rm -rf /var/lib/apt/lists/*

# hdf5 needed for pytables installation
# libgles2-mesa needed for pytest-qt
RUN apt-get install -y libhdf5-dev libgles2-mesa-dev
RUN apt-get update && apt-get install -y \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Can you combine these two installs?
  2. Can you include --no-install-recommends?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, done. That saves another ~0.16 Gb.

Do note that the --no-install-recommends could impact 'downstream' images based on this image, if they depend on having a recommended library installed.

build-essential \
bash-completion \
# hdf5 needed for pytables installation
libhdf5-dev \
# libgles2-mesa needed for pytest-qt
libgles2-mesa-dev && \
rm -rf /var/lib/apt/lists/*

RUN python -m pip install --upgrade pip
COPY requirements-dev.txt /tmp
RUN python -m pip install -r /tmp/requirements-dev.txt
RUN python -m pip install --no-cache-dir --upgrade pip && \
python -m pip install --no-cache-dir -r /tmp/requirements-dev.txt
RUN git config --global --add safe.directory /home/pandas

ENV SHELL="/bin/bash"
Expand Down
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.