[backport 7.x] [Build] On aarch64 docker build, install noarch version of bind-license first (#12891) (#12900)

Backport PR #12891 to 7.x branch. Original message:

On aarch64, yum does not pick the correct 'bind-license' package,
this commit installs a specific noarch RPM

This commit also adds retry to the yum installs and updates.
This commit is contained in:
Rob Bavey 2021-05-12 05:12:56 -04:00 committed by GitHub
parent 4f58cb3bf5
commit e5e41f85c4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -29,8 +29,30 @@ FROM {{ base_image }}
# Install Java and the "which" command, which is needed by Logstash's shell
# scripts.
# Minimal distributions also require findutils tar gzip (procps for integration tests)
RUN {{ package_manager }} update -y && {{ package_manager }} install -y procps findutils tar gzip which shadow-utils && \
{{ package_manager }} clean all
# on aarch64, yum does not pick the right `bind-license` package for some reason
# here we install a specific noarch RPM.
{% if arch == 'aarch64' -%}
RUN for iter in {1..10}; do {{ package_manager }} install -y http://mirror.centos.org/centos/7/updates/x86_64/Packages/bind-license-9.11.4-26.P2.el7_9.5.noarch.rpm && \
{{ package_manager }} clean all && \
{{ package_manager }} clean metadata && \
exit_code=0 && break || exit_code=$? && \
echo "packaging error: retry $iter in 10s" && \
{{ package_manager }} clean all && \
{{ package_manager }} clean metadata && sleep 10; done; \
(exit $exit_code)
{% endif -%}
RUN for iter in {1..10}; do {{ package_manager }} update -y && \
{{ package_manager }} install -y procps findutils tar gzip which shadow-utils && \
{{ package_manager }} clean all && \
{{ package_manager }} clean metadata && \
exit_code=0 && break || exit_code=$? && \
echo "packaging error: retry $iter in 10s" && \
{{ package_manager }} clean all && \
{{ package_manager }} clean metadata && sleep 10; done; \
(exit $exit_code)
# Provide a non-root user to run the process.
RUN groupadd --gid 1000 logstash && \