Cleanup after Ubuntu apt and pip installs
Description
For each apt install, we should update, install and clean all in the same RUN. This avoids carrying around apt temporary files in intermediate layers.
Also, during pip installs, do not cache temporary files.
Containers Affected
Ubuntu-22 Ubuntu-24
Maybe Use cache mounts.
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
apt update && apt-get --no-install-recommends install -y gcc
RUN --mount=type=cache,target=/root/.cache/pip \
pip install -r requirements.txt
I like that. Let me try it. Thanks!
The Fedora 41 image uses cache mounts.
Any intention to update this PR or can it be closed?
@osteffenrh I plan to update it, but it's not a priority right now. I need to migrate us to Ubuntu24, so I'll definitely be revisiting this. My guess is it'll be in the August time frame. If you want to close it, I'll re-open it when I get back to it.
@jgarver, no rush. Let's leave this open then. Thanks!
@jgarver, I just merged #115 which adds cahce mounts to the apt cache directories. Can you check how that overlaps with this PR and if needed update it or close? Thanks!