Skip to content

feat: Add Docker image for pngcrush with optimized settings#505

Open
Balou9 wants to merge 4 commits into
FerretDB:mainfrom
Balou9:pngcrush
Open

feat: Add Docker image for pngcrush with optimized settings#505
Balou9 wants to merge 4 commits into
FerretDB:mainfrom
Balou9:pngcrush

Conversation

@Balou9

@Balou9 Balou9 commented Jul 31, 2025

Copy link
Copy Markdown

This pull request introduces a new Dockerfile for pngcrush.
First step for FerretDB/FerretDB#4637

Issues

  • inconsistent pngcrush behavior
  • inefficient per-file invocation

Improvements

  • consistent pngcrush version
  • optimized compression flags

@Balou9 Balou9 requested a review from AlekSi as a code owner July 31, 2025 02:01
@@ -0,0 +1,10 @@
FROM alpine:3.18

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why that version?

@Balou9 Balou9 Aug 1, 2025

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was unsure which version to use. Thought full semantic versions for base images are good for reproducibility. It makes more sense to use the latest image 3.22, right?!

Comment on lines +3 to +5
RUN apk update && \
apk add --no-cache pngcrush \
rm -rf /var/cache/apk/*

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need both --no-cache and update + rm?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rm removes any remaining package cache files from the /var/cache/apk directory. Even with --no-cache, some temporary files or metadata might persist, or if apk update was run, its fetched index files would be present. This rm command ensures a thorough cleanup, further reducing the final image size

Comment thread ferretdb-pngcrush/Dockerfile Outdated
WORKDIR /workdir

ENTRYPOINT ["/usr/bin/pngcrush"]
CMD ["-ow", "-brute", "-reduce", "-rem", "allb"] No newline at end of file

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need allb?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure if we really need this. It was an attempt to check every possible parameter to reduce file size or in this case remove all ancillary (non-essential) chunks/metadata.

Comment thread ferretdb-pngcrush/Dockerfile Outdated
@Balou9 Balou9 requested a review from AlekSi August 1, 2025 21:39
@AlekSi AlekSi self-assigned this Aug 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In progress

Development

Successfully merging this pull request may close these issues.

2 participants