Skip to content

Commit

Permalink
Add support for ubi8-complete image
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewvc committed Oct 21, 2021
1 parent cb9d3a7 commit 2e9fe8a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
1 change: 1 addition & 0 deletions dev-tools/packaging/packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,7 @@ shared:
extra_vars:
image_name: '{{.BeatName}}-ubi8'
from: 'docker.elastic.co/ubi8/ubi-minimal'
variants: ["complete"]

- &docker_arm_ubi_spec
extra_vars:
Expand Down
20 changes: 16 additions & 4 deletions dev-tools/packaging/templates/docker/Dockerfile.elastic-agent.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ ENV ELASTIC_AGENT_IMAGE_VARIANT={{.Variant}}
ENV BEAT_SETUID_AS={{ .user }}

{{- if contains .from "ubi-minimal" }}
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)
RUN for iter in {1..10}; do rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm && 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)
RUN microdnf install -y jq
{{- else }}
# Installing jq needs to be installed after epel-release and cannot be in the same yum install command.
RUN case $(arch) in aarch64) YUM_FLAGS="-x bind-license";; esac; \
Expand All @@ -58,7 +59,8 @@ RUN case $(arch) in aarch64) YUM_FLAGS="-x bind-license";; esac; \
(exit $exit_code)
{{- end }}

{{- if (and (eq .Variant "complete") (not (contains .from "ubi-minimal"))) }}
{{- if (eq .Variant "complete") }}
{{- if (not (contains .from "ubi-minimal")) }}
RUN for iter in {1..10}; do \
yum -y install atk cups gtk gdk xrandr pango libXcomposite libXcursor libXdamage \
libXext libXi libXtst cups-libs libXScrnSaver libXrandr GConf2 \
Expand All @@ -68,6 +70,16 @@ RUN for iter in {1..10}; do \
exit_code=0 && break || exit_code=$? && echo "yum error: retry $iter in 10s" && sleep 10; \
done; \
(exit $exit_code)
{{- else }}
RUN for iter in {1..10}; do \
microdnf -y install atk cups xrandr pango libXcomposite libXcursor libXdamage \
libXext libXi libXtst cups-libs libXScrnSaver libXrandr GConf2 \
alsa-lib atk gtk3 findutils tar xz && \
microdnf clean all && \
exit_code=0 && break || exit_code=$? && echo "microdnf error: retry $iter in 10s" && sleep 10; \
done; \
(exit $exit_code)
{{- end }}
ENV NODE_PATH={{ $beatHome }}/.node
RUN echo \
$NODE_PATH \
Expand Down Expand Up @@ -156,7 +168,7 @@ RUN mkdir /app
{{- else }}
RUN groupadd --gid 1000 {{ .BeatName }}
RUN useradd -M --uid 1000 --gid 1000 --groups 0 --home {{ $beatHome }} {{ .user }}
{{- if (and (eq .Variant "complete") (not (contains .from "ubi-minimal"))) }}
{{- if (eq .Variant "complete") }}
RUN chown {{ .user }} $NODE_PATH
{{- end }}
{{- if contains .image_name "-cloud" }}
Expand All @@ -167,7 +179,7 @@ RUN chown {{ .user }} /app
{{- end }}
USER {{ .user }}

{{- if (and (eq .Variant "complete") (not (contains .from "ubi-minimal"))) }}
{{- if (eq .Variant "complete") }}
# Setup synthetics env vars
ENV ELASTIC_SYNTHETICS_CAPABLE=true
ENV SUITES_DIR={{ $beatHome }}/suites
Expand Down

0 comments on commit 2e9fe8a

Please sign in to comment.