numerous-refrigerator-93306
08/18/2025, 3:41 AMroot@Beepy:/data/OpenHands (openpaws)# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
gitlab.wolfspyre.io:5009/wpl_containers/openhands/runtime 250816 cc643f49c731 9 minutes ago 7.97GB
gitlab.wolfspyre.io:5009/wpl_containers/openhands/openhands 250816 97b377b40c17 17 hours ago 2.18GB
still got a ways to go, but now that I have a thing that's actually WORKING... I figured I'd share some of the bits ...
first step from upstream base containers looks something like:
&& echo "Removing documentation: https://wiki.ubuntu.com/ReducingDiskFootprint#Drop_unnecessary_files" \
&& find /usr/share/doc /tmp /var/log -depth -type f |xargs rm || true \
&& find /usr/share/doc -empty|xargs rmdir || true \
&& rm -rf /usr/share/man /usr/share/groff /usr/share/info /usr/share/lintian /usr/share/linda /var/cache/man \
&& echo "Removing Locales: https://wiki.ubuntu.com/ReducingDiskFootprint#Drop_unnecessary_files" \
&& find /usr/share/locale -mindepth 1 -maxdepth 1 ! -name 'en*' -exec rm -r {} + \
&& echo "Removing cruft" \
&& for PRUNE_TARGET in /home/pn /home/ubuntu /root/.cache/pip /root/.wget-hsts /tmp/install.log \
/usr/local/CHANGELOG.md /usr/local/README.md /usr/local/VERSION /var/cache/debconf/config.dat-old \
/var/cache/debconf/templates.dat-old /var/cache/ldconfig/aux-cache /var/lib/apt/lists/* \
/var/lib/dpkg/diversions-old /var/lib/dpkg/status-old /var/log/alternatives.log \
/var/log/apt/eipp.log.xz /var/log/apt/history.log /var/log/apt/term.log /var/log/dpkg.log; do \
if [ -d "${PRUNE_TARGET}" ]; then \
echo "Prune Target directory '${PRUNE_TARGET}' detected. Recursively Removing it."; rm -rf "${PRUNE_TARGET}"; \
elif [ -f "${PRUNE_TARGET}" ]; then \
echo "Prune Target file '${PRUNE_TARGET}' detected. Removing it."; rm "${PRUNE_TARGET}"; \
else \
echo "NOOP on non-existent prune target '${PRUNE_TARGET}'"; \
fi; \
done \
&& echo "Populating apt.conf.d files" \
&& echo 'APT::Install-Recommends "false";' > /etc/apt/apt.conf.d/99synaptics \
&& echo '/etc/apt/apt.conf.d/99synaptics OK' \
&& echo 'Apt::AutoRemove::SuggestsImportant "false";'> /etc/apt/apt.conf.d/docker-autoremove-suggests \
&& echo '/etc/apt/apt.conf.d/docker-autoremove-suggests OK' \
&& echo 'DPkg::Post-Invoke { "rm -f /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin || true"; };'> /etc/apt/apt.conf.d/docker-clean \
&& echo 'APT::Update::Post-Invoke { "rm -f /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin || true"; };' >> /etc/apt/apt.conf.d/docker-clean \
&& echo 'Dir::Cache::pkgcache "";' >> /etc/apt/apt.conf.d/docker-clean \
&& echo 'Dir::Cache::srcpkgcache "";' >> /etc/apt/apt.conf.d/docker-clean \
&& echo '/etc/apt/apt.conf.d/docker-clean OK' \
&& echo 'Acquire::GzipIndexes "true"; # https://wiki.ubuntu.com/ReducingDiskFootprint#Drop_unnecessary_files'> /etc/apt/apt.conf.d/docker-gzip-indexes \
&& echo 'Acquire::CompressionTypes::Order:: "gz";' >> /etc/apt/apt.conf.d/docker-gzip-indexes \
&& echo '/etc/apt/apt.conf.d/docker-gzip-indexes OK' \
&& echo 'Acquire::Languages "none";'>/etc/apt/apt.conf.d/docker-no-languages \
&& echo '/etc/apt.conf.d/docker-no-languages OK' \
&& apt-get update
that prunes a WHOLE LOT of cruft. doing the purge portion of it helps in mid-layers depending on what shit gets installed.
The pattern I've come up with for package installs (after several iterations) ... that I THINK I like?
apt-get update \
&& echo "not installing ca-certificates netbase libssl3 openssl as they are already installed" \
&& PKGS=(curl gosu sudo git less openssl procps ssh wget) \
&& DEPS=(git-man libbrotli1 libbsd0 libcbor0.8 libcurl3-gnutls libcurl4 libedit2 liberror-perl libexpat1 libfido2-1 libgdbm-compat4 libldap-2.5-0 libnghttp2-14 libperl5.36 libproc2-0 libpsl5 librtmp1 libsasl2-2 libsasl2-modules-db libssh2-1 libssl3 libwrap0 openssh-client openssh-server openssh-sftp-server perl perl-modules-5.36 runit-helper sensible-utils ucf) \
&& DEBIAN_FRONTEND=noninteractive apt-get upgrade -y --no-install-recommends "${PKGS[@]}" "${DEPS[@]}"