From e5b2b3d92b49ccc45175ece69931591793c9fdf5 Mon Sep 17 00:00:00 2001 From: Rob Bavey Date: Thu, 4 Apr 2024 18:15:54 -0400 Subject: [PATCH] Update Dockerfile to select appropriate architecture on build box (#16053) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit adds logic to copy the appropriate env2yaml file to the Docker image * Clean up env2yaml folder Co-authored-by: João Duarte --- docker/templates/Dockerfile.erb | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/docker/templates/Dockerfile.erb b/docker/templates/Dockerfile.erb index 3aa0deec452..26a7f036181 100644 --- a/docker/templates/Dockerfile.erb +++ b/docker/templates/Dockerfile.erb @@ -148,12 +148,26 @@ COPY config/pipelines.yml config/pipelines.yml COPY config/log4j2.properties config/ COPY config/log4j2.file.properties config/ COPY pipeline/default.conf pipeline/logstash.conf +COPY env2yaml/env2yaml-amd64 env2yaml/ +COPY env2yaml/env2yaml-arm64 env2yaml/ + RUN chown --recursive logstash:root config/ pipeline/ # Ensure Logstash gets the correct locale by default. ENV LANG=<%= locale %> LC_ALL=<%= locale %> + # Copy over the appropriate env2yaml artifact -ARG TARGETARCH -COPY env2yaml/env2yaml-${TARGETARCH} /usr/local/bin/env2yaml +RUN env2yamlarch="$(arch)"; \ + case "${env2yamlarch}" in \ + 'x86_64') \ + env2yamlarch=amd64; \ + ;; \ + 'aarch64') \ + env2yamlarch=arm64; \ + ;; \ + *) echo >&2 "error: unsupported architecture '$env2yamlarch'"; exit 1 ;; \ + esac; \ + cp env2yaml/env2yaml-${env2yamlarch} /usr/local/bin/env2yaml; \ + rm -rf env2yaml # Place the startup wrapper script. COPY bin/docker-entrypoint /usr/local/bin/