refactor: chown on COPY in Dockerfile to reduce image size#8427
Conversation
GiedriusS
left a comment
There was a problem hiding this comment.
Before this change, there were probably two layers inside the image with the same binary? Do I understand it correctly?
|
Yes, it appears so. I can paste screenshots from dive when I'm back at my workstation. |
Signed-off-by: Erik Godding Boye <[email protected]>
9945eca to
8dedfd0
Compare
|
With a little help from ChatGPT to save time, this is better because:
|
|
Thanks for the review, @GiedriusS! The Thanos binary is still huge and contributes to 99% of the image size. Any idea why? Anything we can do to reduce the size of the binary while not breaking stuff? |


Changes
Modified the Dockerfile to perform the chown when copying the Thanos binary into the image. This reduces the image size by a significant amount, from 244 MB to 141 MB.
We just migrated away from the to-be💵images provided by Bitnami/Broadcom, and I was a bit surprised by the difference in image size between the official Thanos image and the bitnami/thanos image.
Verification
I ran
make dockerand verified that the image built starts as normal.