-
Notifications
You must be signed in to change notification settings - Fork 2
Feature/image size optimisation #13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Consolidated multiple RUN commands into single layers to minimize image size. Combined apt-get operations with cleanup in one RUN statement. Added fd-find removal after use and comprehensive cleanup of docs, man pages, cache, and temp files. Reorganized multi-stage build with clearer stage comments and added final cleanup of copied PostgreSQL version directories.
…d binary stripping Restructured Dockerfile to use multi-stage build pattern with pg-all stage for extracting PostgreSQL 14/15 binaries. Added strip operations to remove debug symbols from all PostgreSQL binaries and shared libraries. Removed unnecessary extension, man, doc, and contrib files from old PostgreSQL versions before copying. Consolidated cleanup operations into single RUN layer and added locale cleanup.
richturner
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a great step in the right direction I think we should limit our images to only include the version of postgres used in our last major release so the idea is you can do rolling upgrades with the various tag versions if needed, we can cut more out of this image then.
Init script should check if old version is one supported.
…AJOR build argument (default 15).
Split build and push steps for both amd64 and arm64 architectures to use --load instead of --push, allowing slim toolkit to optimize images before pushing. Added slim toolkit installation and slimming steps that preserve all necessary PostgreSQL paths, libraries, and binaries while removing unused components. Fixed arm64 platform specification from linux/aarch64 to linux/arm64. Added build_and_slim.sh script for build and slimming
richturner
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- If using a bash script then this should be reused by the github workflow to avoid duplication.
- Is there any value in removing some of the TS versions from the build?
- Don't know how
slimworks but hopefully there isn't something it has missed in its' optimisation also does it provide enough benefit to warrant the extra dependency vs. just manually deleting stuff out of the image - If sticking with a bash script then use
--build-argto pass PG_MAJOR to docker build otherwise there is a potential mismatch issue.
…cumentation Extracted duplicated slim toolkit configuration from GitHub Actions workflow into shared slim-image.sh script. Updated build_and_slim.sh to use the shared script with architecture detection. Enhanced README with prerequisites, installation instructions, and detailed upgrade documentation including manual upgrade steps and useful resources. Improved error messages in or-entrypoint.sh to include documentation links for OpenRemote, PostgreSQL and TimescaleDB
Not sure, but no TS version gets removed? The Dockerfile uses timescale/timescaledb-ha base image which includes multiple TimescaleDB versions.
Slim is a tool that runs the container, monitors which files are actually accessed, and removes everything else. We whitelist specific paths (PostgreSQL dirs, shell utilities used by the entrypoint) to ensure nothing critical is removed. Why slim vs alternatives:
Slim provides ~60% size reduction with minimal effort. The trade-off is an extra CI dependency (installed via one-liner script) and the risk of missing edge-case files - which we mitigate with explicit |
…d updating README with manual build steps
richturner
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just built image locally without slim and started the container with a 14.6.0.3 DB and the container doesn't start but I also don't get the expected error messages in docker logs, just see this:
/usr/bin/env: ‘bash\r’: No such file or directory
Ignore I think this is a lie ending issue with gihub checkout |
|
I upgraded from |
|
Here's the |
|
I can see |
Reduces some of the size.
#12