Repository navigation
Description
The -slim tags are no longer smaller than the full images. Up to 17.9.0.1 they were about 58% smaller, in line with the ~60% in the README:
| Tag | amd64 | arm64 |
|---|---|---|
17.9.0.1 |
2053 MB | 2111 MB |
17.9.0.1-slim |
856 MB | 833 MB |
17.11.1.0, latest, develop |
1499 MB | 1442 MB |
17.11.1.0-slim, latest-slim, develop-slim |
1525 MB | 1456 MB |
These are the compressed sizes on Docker Hub. Core's profile/deploy.yml defaults to develop-slim (also see https://github.com/search?q=org%3Aopenremote+path%3A.env+-slim&type=code), so CI, custom projects and deployments all pull it. A slim image is a single layer, so every build means a full 1.5 GB download that can't be split into parallel layer pulls. In CI that pull takes 25 s to 1.5 min.
Cause
Uncompressed, the amd64 slim layer grew from 2.7 GB (17.9.0.1) to 4.9 GB (develop). Two things add most of the size:
- Unstripped TimescaleDB Toolkit libraries.
timescaledb_toolkit-1.23.0.soto1.26.0.soare 174 to 181 MB each, against 15 MB for 1.19.0 to 1.22.0. They are in bothlib/postgresql/17andlib/postgresql/15, so 8 files and 1.4 GB in total. Debug sections are 163 MB of each file:strip --strip-unneededtakes 1.26.0 from 181 MB to 15.5 MB, or from 35 MB to 5 MB gzipped.
The Dockerfile strips libraries in the first stage and in the final stage, but neither step changes anything. The timescaledb-ha image has nostripbinary, and2>/dev/null || truehides the error. The PG 15 libraries copied from the first stage are unstripped too, and the finalRUNlayer ofdevelophas no files under/usr/lib/postgresql. - Fastest gzip level. Since Recompress slim layers to gzip before pushing #33 the slim layer is recompressed with
regctl image mod --layer-compress gzip. That writes gzip's fastest level: the XFL byte in the gzip header is 4, where17.9.0.1-slimhas 0. Recompressing thedevelop-slimlayer withgzip -6gives 1312 MB instead of 1525 MB.
Fixing both would bring develop-slim to about 1.07 GB, or 3.6 GB uncompressed. The rest of the growth since 17.9.0.1 is the TimescaleDB versions kept for upgrades: 90 libraries instead of 64, and 2305 upgrade scripts instead of 1460.
Suggested fix
- Strip with a
stripthat exists, for example by installing binutils in a build stage. Drop2>/dev/null || trueso that a missing tool fails the build. Stripping in the final stage only shrinks the slim image, because the full image keeps the unstripped files in the upstream layer. - Recompress the slim layer at gzip's default level or higher.
- Fail the workflow when the slim image isn't smaller than the full image.
Activity