Skip to content

Trim down the docker image size - #55

Merged
pkonieczny merged 1 commit into
masterfrom
pawel/dev-11952-trim-down-size-of-refgenomicsdocker-onecodex-notebook-docker
Aug 31, 2026
Merged

Trim down the docker image size#55
pkonieczny merged 1 commit into
masterfrom
pawel/dev-11952-trim-down-size-of-refgenomicsdocker-onecodex-notebook-docker

Conversation

@pkonieczny

Copy link
Copy Markdown
Contributor

This PR trims down the size of the docker image from ~3.8GB to ~1.2GB. Out of the remaining size, >1GB are the Python packages that we probably want to keep around.
The image could be further trimmed a bit but not without consequence (e.g. slower package loading on start). Let's only get to that if we deem it necessary.

Note: this PR removes the compilers and their tooling (~600MB) from the image so only Python packages with wheels can be installed, if a package requires compilation, it will fail the pip install.

Comment thread Dockerfile
# chown has to be run in the same command otherwise the files are copied in the next docker layer
RUN pip install --no-cache-dir -U pip && \
pip install --no-cache-dir -q -r /root/requirements.txt && \
rm -rf /usr/local/lib/python3.13/site-packages/biom/tests && \

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Are there other tests we could remove, e.g. scikit-bio's?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, but they're not that big - I figured simplicity wins over chipping away more tiny pieces 🤷

Comment thread Dockerfile
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && apt-get install -yq --no-install-recommends \
apt-transport-https \
build-essential \

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can you confirm with @clausmith @lynchde on the wheel-only change?

Comment thread requirements.txt
# jupyter_contrib_nbextensions imports pkg_resources, which setuptools removed
# in v81; the python:3.13-slim base image no longer ships setuptools at all.
setuptools<81
awscli

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I wonder why we had this as a dependency

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I vaguely remember at one point the main container uploading the ipynb file. It's now done in a sidecar that has a different image with awscli.

@pkonieczny
pkonieczny merged commit f8a7208 into master Aug 31, 2026
1 check passed
@pkonieczny
pkonieczny deleted the pawel/dev-11952-trim-down-size-of-refgenomicsdocker-onecodex-notebook-docker branch August 31, 2026 10:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants