From 3fb03f44e3aeea1d5ae7cccc6aae09c43c8fcecb Mon Sep 17 00:00:00 2001 From: Alfredo Gutierrez Date: Mon, 1 Apr 2024 15:10:00 -0600 Subject: [PATCH] merged commands to improve amount of layers as recommended by Wiz IaC Scanner on PR review Signed-off-by: Alfredo Gutierrez --- auth-layer-proxy/Dockerfile | 44 +++++++++++++------------------------ 1 file changed, 15 insertions(+), 29 deletions(-) diff --git a/auth-layer-proxy/Dockerfile b/auth-layer-proxy/Dockerfile index bc55124..34b9c02 100644 --- a/auth-layer-proxy/Dockerfile +++ b/auth-layer-proxy/Dockerfile @@ -1,29 +1,15 @@ -FROM envoyproxy/envoy:v1.28-latest - -# Copy the Filter Scripts -COPY /filters/ /etc/envoy/filters/ -# Copy the Configs templates -COPY /configs/ /etc/envoy/configs/ -# Copy the start script -COPY /scripts/start-envoy.sh /etc/envoy/start-envoy.sh - -# Make the script executable -RUN chmod +x /etc/envoy/start-envoy.sh -# give ownership to envoy user -RUN chown -R envoy:envoy /etc/envoy - -# install gettext for envsubst -RUN apt-get update -RUN apt-get install -y gettext-base - -# Install Lua and Luarocks -RUN apt-get update && apt-get install -y lua5.1 luarocks git - -# clean up temp data -RUN rm -rf /var/lib/apt/lists/* - -# Install Lua modules -RUN luarocks install lua-cjson - -# Install http socket module -RUN luarocks install luasocket +FROM envoyproxy/envoy:v1.28-latest + +# Copy all necessary files +COPY /filters/ /etc/envoy/filters/ +COPY /configs/ /etc/envoy/configs/ +COPY /scripts/start-envoy.sh /etc/envoy/start-envoy.sh + +# Make the start script executable, change ownership, install dependencies, and clean up in a single RUN to reduce layers +RUN chmod +x /etc/envoy/start-envoy.sh && \ + chown -R envoy:envoy /etc/envoy && \ + apt-get update && \ + apt-get install -y gettext-base lua5.1 luarocks git && \ + luarocks install lua-cjson && \ + luarocks install luasocket && \ + rm -rf /var/lib/apt/lists/*