Skip to content
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

Cleanup dockerfile #183334

Merged
merged 5 commits into from
May 14, 2024
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,33 @@ RUN tar \
# OpenShift does this, for example.
# REF: https://docs.openshift.org/latest/creating_images/guidelines.html
RUN chmod -R g=u /usr/share/kibana
{{#cloud}}

# Add an init process, check the checksum to make sure it's a match
RUN set -e ; \
TINI_BIN="" ; \
case "$(arch)" in \
aarch64) \
TINI_BIN='tini-arm64' ; \
;; \
x86_64) \
TINI_BIN='tini-amd64' ; \
;; \
*) echo >&2 "Unsupported architecture $(arch)" ; exit 1 ;; \
esac ; \
TINI_VERSION='v0.19.0' ; \
curl --retry 8 -S -L -O "https://github.com/krallin/tini/releases/download/${TINI_VERSION}/${TINI_BIN}" ; \
curl --retry 8 -S -L -O "https://github.com/krallin/tini/releases/download/${TINI_VERSION}/${TINI_BIN}.sha256sum" ; \
sha256sum -c "${TINI_BIN}.sha256sum" ; \
rm "${TINI_BIN}.sha256sum" ; \
mv "${TINI_BIN}" /bin/tini ; \
chmod +x /bin/tini
{{^serverless}}
RUN mkdir -p /usr/share/fonts/local && \
curl --retry 8 -S -L -o /usr/share/fonts/local/NotoSansCJK-Regular.ttc https://github.com/googlefonts/noto-cjk/raw/NotoSansV2.001/NotoSansCJK-Regular.ttc && \
echo "5dcd1c336cc9344cb77c03a0cd8982ca8a7dc97d620fd6c9c434e02dcb1ceeb3 /usr/share/fonts/local/NotoSansCJK-Regular.ttc" | sha256sum -c -
{{/serverless}}

{{#cloud}}
COPY {{filebeatTarball}} /tmp/filebeat.tar.gz
COPY {{metricbeatTarball}} /tmp/metricbeat.tar.gz

Expand Down Expand Up @@ -79,44 +104,25 @@ RUN for iter in {1..10}; do \
{{packageManager}} update && \
{{packageManager}} upgrade -y && \
{{packageManager}} install -y --no-install-recommends \
fontconfig fonts-liberation libnss3 libfontconfig1 ca-certificates curl && \
Copy link
Member Author

Choose a reason for hiding this comment

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

libfontconfig1 is already a dependency of fontconfig. fonts-liberation is superseded by the installed font NotoSansCJK.

@elastic/kibana-reporting-services any idea if I'm missing anything? I'm pretty sure we're okay, tests are passing and my manual checks lgtm.

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

cc @tsullivan - we both don't spot anything missing in the Dockerfile. Thank you!

Ikuni17 marked this conversation as resolved.
Show resolved Hide resolved
fontconfig libnss3 ca-certificates && \
{{packageManager}} clean && \
rm -rf /var/lib/apt/lists/* && exit_code=0 && break || exit_code=$? && echo "{{packageManager}} error: retry $iter in 10s" && \
sleep 10; \
done; \
(exit $exit_code)
{{/ubuntu}}

# Add an init process, check the checksum to make sure it's a match
RUN set -e ; \
TINI_BIN="" ; \
case "$(arch)" in \
aarch64) \
TINI_BIN='tini-arm64' ; \
;; \
x86_64) \
TINI_BIN='tini-amd64' ; \
;; \
*) echo >&2 "Unsupported architecture $(arch)" ; exit 1 ;; \
esac ; \
TINI_VERSION='v0.19.0' ; \
curl --retry 8 -S -L -O "https://github.com/krallin/tini/releases/download/${TINI_VERSION}/${TINI_BIN}" ; \
curl --retry 8 -S -L -O "https://github.com/krallin/tini/releases/download/${TINI_VERSION}/${TINI_BIN}.sha256sum" ; \
sha256sum -c "${TINI_BIN}.sha256sum" ; \
rm "${TINI_BIN}.sha256sum" ; \
mv "${TINI_BIN}" /bin/tini ; \
chmod +x /bin/tini

RUN mkdir /usr/share/fonts/local
RUN curl --retry 8 -S -L -o /usr/share/fonts/local/NotoSansCJK-Regular.ttc https://github.com/googlefonts/noto-cjk/raw/NotoSansV2.001/NotoSansCJK-Regular.ttc
RUN echo "5dcd1c336cc9344cb77c03a0cd8982ca8a7dc97d620fd6c9c434e02dcb1ceeb3 /usr/share/fonts/local/NotoSansCJK-Regular.ttc" | sha256sum -c -
RUN fc-cache -v

# Bring in Kibana from the initial stage.
COPY --from=builder --chown=1000:0 /usr/share/kibana /usr/share/kibana
COPY --from=builder --chown=0:0 /bin/tini /bin/tini
{{#cloud}}
COPY --from=builder --chown=0:0 /opt /opt
{{/cloud}}
{{^serverless}}
# Load reporting fonts
COPY --from=builder --chown=0:0 /usr/share/fonts/local/NotoSansCJK-Regular.ttc /usr/share/fonts/local/NotoSansCJK-Regular.ttc
RUN fc-cache -v
{{/serverless}}
WORKDIR /usr/share/kibana
{{#fips}}

Expand Down