@@ -27,42 +27,51 @@ RUN mkdir -p {{ $beatHome }}/data {{ $beatHome }}/data/elastic-agent-{{ commit_s
2727{{- end }}
2828 true
2929
30- {{- if .linux_capabilities }}
31- # Since the beat is stored at the other end of a symlink we must follow the symlink first
32- # For security reasons setcap does not support symlinks. This is smart in the general case
33- # but in our specific case since we're building a trusted image from trusted binaries this is
34- # fine. Thus, we use readlink to follow the link and setcap on the actual binary
35- RUN readlink -f {{ $beatBinary }} | xargs setcap {{ .linux_capabilities }}
36- {{- end }}
37-
3830FROM {{ .from }}
3931
4032ENV BEAT_SETUID_AS={{ .user }}
4133
4234{{- if contains .from "ubi-minimal" }}
43- RUN for iter in {1..10}; do microdnf update -y && microdnf install -y shadow-utils jq && microdnf clean all && exit_code=0 && break || exit_code=$? && echo "microdnf error: retry $iter in 10s" && sleep 10; done; (exit $exit_code)
35+ RUN for iter in {1..10}; do microdnf update -y && microdnf install -y findutils shadow-utils && microdnf clean all && exit_code=0 && break || exit_code=$? && echo "microdnf error: retry $iter in 10s" && sleep 10; done; (exit $exit_code)
4436{{- else }}
45- # Installing jq needs to be installed after epel-release and cannot be in the same yum install command.
46- RUN case $(arch) in aarch64) YUM_FLAGS="-x bind-license";; esac; \
47- for iter in {1..10}; do \
48- yum update -y $YUM_FLAGS && \
49- yum install -y epel-release && \
50- yum update -y $YUM_FLAGS && \
51- yum install -y jq && \
52- yum clean all && \
53- exit_code=0 && break || exit_code=$? && echo "yum error: retry $iter in 10s" && sleep 10; \
37+
38+ RUN for iter in {1..10}; do \
39+ apt-get update -y && \
40+ DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends --yes ca-certificates curl libcap2-bin xz-utils && \
41+ apt-get clean all && \
42+ exit_code=0 && break || exit_code=$? && echo "apt-get error: retry $iter in 10s" && sleep 10; \
5443 done; \
5544 (exit $exit_code)
5645{{- end }}
5746
5847{{- if (and (contains .image_name "-complete") (not (contains .from "ubi-minimal"))) }}
59- RUN for iter in {1..10}; do \
60- yum -y install atk gtk gdk xrandr pango libXcomposite libXcursor libXdamage \
61- libXext libXi libXtst libXScrnSaver libXrandr GConf2 \
62- alsa-lib atk gtk3 ipa-gothic-fonts xorg-x11-fonts-100dpi xorg-x11-fonts-75dpi xorg-x11-utils \
63- xorg-x11-fonts-cyrillic xorg-x11-fonts-Type1 xorg-x11-fonts-misc \
64- yum clean all && \
65- exit_code=0 && break || exit_code=$? && echo "yum error: retry $iter in 10s" && sleep 10; \
48+ RUN apt-get update -y && \
49+ for iter in {1..10}; do \
50+ DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends --yes \
51+ libglib2.0-0\
52+ libnss3\
53+ libnspr4\
54+ libatk1.0-0\
55+ libatk-bridge2.0-0\
56+ libcups2\
57+ libdrm2\
58+ libdbus-1-3\
59+ libxcb1\
60+ libxkbcommon0\
61+ libx11-6\
62+ libxcomposite1\
63+ libxdamage1\
64+ libxext6\
65+ libxfixes3\
66+ libxrandr2\
67+ libgbm1\
68+ libpango-1.0-0\
69+ libcairo2\
70+ libasound2\
71+ libatspi2.0-0\
72+ libxshmfence1 && \
73+ apt-get clean all && \
74+ exit_code=0 && break || exit_code=$? && echo "apt-get error: retry $iter in 10s" && sleep 10; \
6675 done; \
6776 (exit $exit_code)
6877ENV NODE_PATH={{ $beatHome }}/.node
@@ -145,6 +154,14 @@ COPY --from=home {{ $beatHome }}/NOTICE.txt /licenses
145154COPY --from=home /opt /opt
146155{{- end }}
147156
157+ {{- if .linux_capabilities }}
158+ # Since the beat is stored at the other end of a symlink we must follow the symlink first
159+ # For security reasons setcap does not support symlinks. This is smart in the general case
160+ # but in our specific case since we're building a trusted image from trusted binaries this is
161+ # fine. Thus, we use readlink to follow the link and setcap on the actual binary
162+ RUN readlink -f {{ $beatBinary }} | xargs setcap {{ .linux_capabilities }}
163+ {{- end }}
164+
148165{{- if eq .user "root" }}
149166{{- if contains .image_name "-cloud" }}
150167# Generate folder for a stub command that will be overwritten at runtime
@@ -213,3 +230,4 @@ RUN echo -e '#!/bin/sh\nexec /usr/local/bin/docker-entrypoint' > /app/apm.sh &&
213230{{- else }}
214231ENTRYPOINT ["/usr/bin/tini", "--", "/usr/local/bin/docker-entrypoint"]
215232{{- end }}
233+
0 commit comments