-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Improve Dockerfile: update base image and optimize image size #2649
Conversation
Dockerfile
Outdated
RUN autoreconf -i \ | ||
&& ./configure \ | ||
--disable-dependency-tracking \ | ||
--disable-silent-rules \ |
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.
Got a curious about these options, seems --disable-silent-rules
is the default? if so maybe can skip specify it? --disable-dependency-tracking
seems to speed up one-time builds by not generate make dependency files, i suspect not much build speed up for jq?
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.
I agree. I'll drop both flags.
rm -rf /app/modules/oniguruma/.git && \ | ||
rm -rf /app/modules/oniguruma/.gitignore && \ | ||
rm -rf /var/lib/apt/lists/* /var/lib/gems | ||
FROM scratch |
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.
In dockerfiles like this i usually have a RUN ["/path/to/binary", "--version"]
just as a sanity test that the binary can run correct in a scratch container, have saved me a couple of times
Dockerfile
Outdated
CMD [] | ||
COPY --from=builder /app/AUTHORS /app/COPYING /usr/local/bin/jq / | ||
ENTRYPOINT ["/jq"] | ||
CMD ["--help"] |
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.
Maybe skip or leave empty to make it behave as normal cli?
c288a96
to
b5dbff5
Compare
Thank you! |
This PR improves Dockerfile to resolve endless reports about the Docker image in the next release. I update the base image to Debian 12, and use multi-stage build to optimize the image size. We stop re-building the parser/lexer codes since that's what we do on building the release executables. We no longer re-build docs and manpage in this image, so drop dependency on Python. Releasing multi-arch image to GHCR will be in the next PR.
This PR closes #845, closes #1631, closes #1900, closes #2004, and closes #2617.