3 ms·
I kinda solve that by doing something like this: # install runtime deps dpkg -l | awk '{print $2}' | sort > old.txt # install build deps # buil
by justinsaccount 11y ago
I kinda solve that by doing something like this:
# install runtime deps
dpkg -l | awk '{print $2}' | sort > old.txt
# install build deps
# build software
dpkg -l | awk '{print $2}' | sort > new.txt
apt-get -y remove --purge $(comm -13 old.txt new.txt)
Probably a better way to accomplish that, but it was the easiest way I could see to implement an 'undo'
- zenlikethat 11y agoIf doing this sort of thing, make sure to accomplish it in a single step (image layer) in the Dockerfile. Otherwise you won't be doing any good as the "removed" files actually persist behind a layer which specifies them as removed.
- justinsaccount 11y agoI've been using docker-squash for that. This way I can take advantage of layer caching during development, and still have a small image for uploading.