From 03e3e27c23372962922d1b99a56c5a2c95a497f9 Mon Sep 17 00:00:00 2001 From: "Sergey A. Osokin" Date: Thu, 3 Dec 2020 14:16:26 -0500 Subject: [PATCH 1/3] Use chown(8) only once. It's possible to pass multiple files to chown utility, so run it only once to make changes. --- build/Dockerfile | 4 ++-- build/DockerfileForAlpine | 4 ++-- build/DockerfileForPlus | 4 ++-- build/DockerfileWithOpentracing | 4 ++-- build/DockerfileWithOpentracingForPlus | 4 ++-- build/appprotect/DockerfileWithAppProtectForPlus | 14 +++++++------- .../DockerfileWithAppProtectForPlusForOpenShift | 14 +++++++------- build/openshift/Dockerfile | 4 ++-- build/openshift/DockerfileForPlus | 4 ++-- 9 files changed, 28 insertions(+), 28 deletions(-) diff --git a/build/Dockerfile b/build/Dockerfile index 5fe5881969..e804fd3a51 100644 --- a/build/Dockerfile +++ b/build/Dockerfile @@ -16,8 +16,8 @@ RUN mkdir -p /var/lib/nginx \ && setcap 'cap_net_bind_service=+ep' /usr/sbin/nginx \ && setcap 'cap_net_bind_service=+ep' /usr/sbin/nginx-debug \ && chown -R nginx:0 /etc/nginx \ - && chown -R nginx:0 /var/cache/nginx \ - && chown -R nginx:0 /var/lib/nginx \ + /var/cache/nginx \ + /var/lib/nginx \ && apt-get remove --purge -y libcap2-bin \ && rm /etc/nginx/conf.d/* \ && rm -rf /var/lib/apt/lists/* diff --git a/build/DockerfileForAlpine b/build/DockerfileForAlpine index 029e7018c7..8347a7ebac 100644 --- a/build/DockerfileForAlpine +++ b/build/DockerfileForAlpine @@ -15,8 +15,8 @@ RUN mkdir -p /etc/nginx/secrets \ && setcap 'cap_net_bind_service=+ep' /usr/sbin/nginx \ && setcap 'cap_net_bind_service=+ep' /usr/sbin/nginx-debug \ && chown -R nginx:0 /etc/nginx \ - && chown -R nginx:0 /var/cache/nginx \ - && chown -R nginx:0 /var/lib/nginx \ + /var/cache/nginx \ + /var/lib/nginx \ && apk del libcap \ && rm /etc/nginx/conf.d/* \ && rm -rf /var/cache/apk/* diff --git a/build/DockerfileForPlus b/build/DockerfileForPlus index 066e8139f9..e9bec0e7e7 100644 --- a/build/DockerfileForPlus +++ b/build/DockerfileForPlus @@ -55,8 +55,8 @@ RUN mkdir -p /var/lib/nginx \ && mkdir -p /etc/nginx/secrets \ && mkdir -p /etc/nginx/stream-conf.d \ && chown -R nginx:0 /etc/nginx \ - && chown -R nginx:0 /var/cache/nginx \ - && chown -R nginx:0 /var/lib/nginx/ \ + /var/cache/nginx \ + /var/lib/nginx/ \ && apt-get remove --purge -y libcap2-bin \ && rm /etc/nginx/conf.d/* diff --git a/build/DockerfileWithOpentracing b/build/DockerfileWithOpentracing index dc61747a2f..270ac3e200 100644 --- a/build/DockerfileWithOpentracing +++ b/build/DockerfileWithOpentracing @@ -82,8 +82,8 @@ RUN mkdir -p /var/lib/nginx \ && setcap 'cap_net_bind_service=+ep' /usr/sbin/nginx \ && setcap 'cap_net_bind_service=+ep' /usr/sbin/nginx-debug \ && chown -R nginx:0 /etc/nginx \ - && chown -R nginx:0 /var/cache/nginx \ - && chown -R nginx:0 /var/lib/nginx \ + /var/cache/nginx \ + /var/lib/nginx \ && apt-get remove --purge -y libcap2-bin \ && rm /etc/nginx/conf.d/* \ && rm -rf /var/lib/apt/lists/* diff --git a/build/DockerfileWithOpentracingForPlus b/build/DockerfileWithOpentracingForPlus index c552e7b79b..68626acbe8 100644 --- a/build/DockerfileWithOpentracingForPlus +++ b/build/DockerfileWithOpentracingForPlus @@ -71,8 +71,8 @@ RUN mkdir -p /var/lib/nginx \ && mkdir -p /etc/nginx/secrets \ && mkdir -p /etc/nginx/stream-conf.d \ && chown -R nginx:0 /etc/nginx \ - && chown -R nginx:0 /var/cache/nginx \ - && chown -R nginx:0 /var/lib/nginx/ \ + /var/cache/nginx \ + /var/lib/nginx/ \ && apt-get remove --purge -y libcap2-bin \ && rm /etc/nginx/conf.d/* diff --git a/build/appprotect/DockerfileWithAppProtectForPlus b/build/appprotect/DockerfileWithAppProtectForPlus index 4318978cc8..8783e5da3d 100644 --- a/build/appprotect/DockerfileWithAppProtectForPlus +++ b/build/appprotect/DockerfileWithAppProtectForPlus @@ -83,13 +83,13 @@ RUN mkdir -p /var/lib/nginx \ && mkdir -p /var/log/app_protect \ && mkdir -p /opt/app_protect \ && chown -R nginx:0 /etc/app_protect \ - && chown -R nginx:0 /usr/share/ts \ - && chown -R nginx:0 /etc/nginx \ - && chown -R nginx:0 /var/cache/nginx \ - && chown -R nginx:0 /var/lib/nginx/ \ - && chown -R nginx:0 /var/log/app_protect/ \ - && chown -R nginx:0 /opt/app_protect/ \ - && chown -R nginx:0 /var/log/nginx/ \ + /usr/share/ts \ + /etc/nginx \ + /var/cache/nginx \ + /var/lib/nginx/ \ + /var/log/app_protect/ \ + /opt/app_protect/ \ + /var/log/nginx/ \ && apt-get remove --purge -y libcap2-bin \ && rm /etc/nginx/conf.d/* diff --git a/build/appprotect/DockerfileWithAppProtectForPlusForOpenShift b/build/appprotect/DockerfileWithAppProtectForPlusForOpenShift index ed4a95115f..736d3f089f 100644 --- a/build/appprotect/DockerfileWithAppProtectForPlusForOpenShift +++ b/build/appprotect/DockerfileWithAppProtectForPlusForOpenShift @@ -83,13 +83,13 @@ RUN mkdir -p /var/lib/nginx \ && mkdir -p /var/log/app_protect \ && mkdir -p /opt/app_protect \ && chown -R nginx:0 /etc/app_protect \ - && chown -R nginx:0 /usr/share/ts \ - && chown -R nginx:0 /etc/nginx \ - && chown -R nginx:0 /var/cache/nginx \ - && chown -R nginx:0 /var/lib/nginx/ \ - && chown -R nginx:0 /var/log/app_protect/ \ - && chown -R nginx:0 /opt/app_protect/ \ - && chown -R nginx:0 /var/log/nginx/ \ + /etc/nginx \ + /opt/app_protect/ \ + /usr/share/ts \ + /var/cache/nginx \ + /var/lib/nginx/ \ + /var/log/app_protect/ \ + /var/log/nginx/ \ && rm /etc/nginx/conf.d/* RUN printf "MODULE = ALL;\nLOG_LEVEL = TS_CRIT;\nFILE = 2;\n" > /etc/app_protect/bd/logger.cfg \ diff --git a/build/openshift/Dockerfile b/build/openshift/Dockerfile index 49971da4a4..2076332204 100644 --- a/build/openshift/Dockerfile +++ b/build/openshift/Dockerfile @@ -27,8 +27,8 @@ RUN set -x \ && setcap 'cap_net_bind_service=+ep' /usr/sbin/nginx \ && setcap 'cap_net_bind_service=+ep' /usr/sbin/nginx-debug \ && chown -R nginx:0 /etc/nginx \ - && chown -R nginx:0 /var/cache/nginx \ - && chown -R nginx:0 /var/lib/nginx \ + /var/cache/nginx \ + /var/lib/nginx \ && rm /etc/yum.repos.d/nginx.repo \ && rm /etc/nginx/conf.d/* diff --git a/build/openshift/DockerfileForPlus b/build/openshift/DockerfileForPlus index ece754e402..2ed8b504ed 100644 --- a/build/openshift/DockerfileForPlus +++ b/build/openshift/DockerfileForPlus @@ -62,8 +62,8 @@ RUN mkdir -p /var/lib/nginx \ && mkdir -p /etc/nginx/secrets \ && mkdir -p /etc/nginx/stream-conf.d \ && chown -R nginx:0 /etc/nginx \ - && chown -R nginx:0 /var/cache/nginx \ - && chown -R nginx:0 /var/lib/nginx/ \ + /var/cache/nginx \ + /var/lib/nginx/ \ && rm /etc/nginx/conf.d/* EXPOSE 80 443 From c7f437bf2ea1c57321e9db17f5121174dc2432c3 Mon Sep 17 00:00:00 2001 From: "Sergey A. Osokin" Date: Thu, 3 Dec 2020 19:48:56 -0500 Subject: [PATCH 2/3] Use original order for the directories. Requsted by: pleshakov --- build/appprotect/DockerfileWithAppProtectForPlusForOpenShift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/appprotect/DockerfileWithAppProtectForPlusForOpenShift b/build/appprotect/DockerfileWithAppProtectForPlusForOpenShift index 736d3f089f..449badbd06 100644 --- a/build/appprotect/DockerfileWithAppProtectForPlusForOpenShift +++ b/build/appprotect/DockerfileWithAppProtectForPlusForOpenShift @@ -83,12 +83,12 @@ RUN mkdir -p /var/lib/nginx \ && mkdir -p /var/log/app_protect \ && mkdir -p /opt/app_protect \ && chown -R nginx:0 /etc/app_protect \ - /etc/nginx \ - /opt/app_protect/ \ /usr/share/ts \ + /etc/nginx \ /var/cache/nginx \ /var/lib/nginx/ \ /var/log/app_protect/ \ + /opt/app_protect/ \ /var/log/nginx/ \ && rm /etc/nginx/conf.d/* From 9297225136c704207b29a34d4db0bd6a1a0632b9 Mon Sep 17 00:00:00 2001 From: "Sergey A. Osokin" Date: Thu, 3 Dec 2020 22:02:33 -0500 Subject: [PATCH 3/3] Use tabs instead of spaces. Requested by: lucacome --- build/Dockerfile | 4 ++-- build/DockerfileForAlpine | 4 ++-- build/DockerfileForPlus | 4 ++-- build/DockerfileWithOpentracing | 4 ++-- build/DockerfileWithOpentracingForPlus | 4 ++-- build/appprotect/DockerfileWithAppProtectForPlus | 14 +++++++------- .../DockerfileWithAppProtectForPlusForOpenShift | 14 +++++++------- build/openshift/Dockerfile | 4 ++-- build/openshift/DockerfileForPlus | 4 ++-- 9 files changed, 28 insertions(+), 28 deletions(-) diff --git a/build/Dockerfile b/build/Dockerfile index e804fd3a51..f3313e09de 100644 --- a/build/Dockerfile +++ b/build/Dockerfile @@ -16,8 +16,8 @@ RUN mkdir -p /var/lib/nginx \ && setcap 'cap_net_bind_service=+ep' /usr/sbin/nginx \ && setcap 'cap_net_bind_service=+ep' /usr/sbin/nginx-debug \ && chown -R nginx:0 /etc/nginx \ - /var/cache/nginx \ - /var/lib/nginx \ + /var/cache/nginx \ + /var/lib/nginx \ && apt-get remove --purge -y libcap2-bin \ && rm /etc/nginx/conf.d/* \ && rm -rf /var/lib/apt/lists/* diff --git a/build/DockerfileForAlpine b/build/DockerfileForAlpine index 8347a7ebac..304cd9ae62 100644 --- a/build/DockerfileForAlpine +++ b/build/DockerfileForAlpine @@ -15,8 +15,8 @@ RUN mkdir -p /etc/nginx/secrets \ && setcap 'cap_net_bind_service=+ep' /usr/sbin/nginx \ && setcap 'cap_net_bind_service=+ep' /usr/sbin/nginx-debug \ && chown -R nginx:0 /etc/nginx \ - /var/cache/nginx \ - /var/lib/nginx \ + /var/cache/nginx \ + /var/lib/nginx \ && apk del libcap \ && rm /etc/nginx/conf.d/* \ && rm -rf /var/cache/apk/* diff --git a/build/DockerfileForPlus b/build/DockerfileForPlus index e9bec0e7e7..fa2fadf976 100644 --- a/build/DockerfileForPlus +++ b/build/DockerfileForPlus @@ -55,8 +55,8 @@ RUN mkdir -p /var/lib/nginx \ && mkdir -p /etc/nginx/secrets \ && mkdir -p /etc/nginx/stream-conf.d \ && chown -R nginx:0 /etc/nginx \ - /var/cache/nginx \ - /var/lib/nginx/ \ + /var/cache/nginx \ + /var/lib/nginx/ \ && apt-get remove --purge -y libcap2-bin \ && rm /etc/nginx/conf.d/* diff --git a/build/DockerfileWithOpentracing b/build/DockerfileWithOpentracing index 270ac3e200..476c10c388 100644 --- a/build/DockerfileWithOpentracing +++ b/build/DockerfileWithOpentracing @@ -82,8 +82,8 @@ RUN mkdir -p /var/lib/nginx \ && setcap 'cap_net_bind_service=+ep' /usr/sbin/nginx \ && setcap 'cap_net_bind_service=+ep' /usr/sbin/nginx-debug \ && chown -R nginx:0 /etc/nginx \ - /var/cache/nginx \ - /var/lib/nginx \ + /var/cache/nginx \ + /var/lib/nginx \ && apt-get remove --purge -y libcap2-bin \ && rm /etc/nginx/conf.d/* \ && rm -rf /var/lib/apt/lists/* diff --git a/build/DockerfileWithOpentracingForPlus b/build/DockerfileWithOpentracingForPlus index 68626acbe8..5e9fe15019 100644 --- a/build/DockerfileWithOpentracingForPlus +++ b/build/DockerfileWithOpentracingForPlus @@ -71,8 +71,8 @@ RUN mkdir -p /var/lib/nginx \ && mkdir -p /etc/nginx/secrets \ && mkdir -p /etc/nginx/stream-conf.d \ && chown -R nginx:0 /etc/nginx \ - /var/cache/nginx \ - /var/lib/nginx/ \ + /var/cache/nginx \ + /var/lib/nginx/ \ && apt-get remove --purge -y libcap2-bin \ && rm /etc/nginx/conf.d/* diff --git a/build/appprotect/DockerfileWithAppProtectForPlus b/build/appprotect/DockerfileWithAppProtectForPlus index 8783e5da3d..2a0f4a579a 100644 --- a/build/appprotect/DockerfileWithAppProtectForPlus +++ b/build/appprotect/DockerfileWithAppProtectForPlus @@ -83,13 +83,13 @@ RUN mkdir -p /var/lib/nginx \ && mkdir -p /var/log/app_protect \ && mkdir -p /opt/app_protect \ && chown -R nginx:0 /etc/app_protect \ - /usr/share/ts \ - /etc/nginx \ - /var/cache/nginx \ - /var/lib/nginx/ \ - /var/log/app_protect/ \ - /opt/app_protect/ \ - /var/log/nginx/ \ + /usr/share/ts \ + /etc/nginx \ + /var/cache/nginx \ + /var/lib/nginx/ \ + /var/log/app_protect/ \ + /opt/app_protect/ \ + /var/log/nginx/ \ && apt-get remove --purge -y libcap2-bin \ && rm /etc/nginx/conf.d/* diff --git a/build/appprotect/DockerfileWithAppProtectForPlusForOpenShift b/build/appprotect/DockerfileWithAppProtectForPlusForOpenShift index 449badbd06..706b674ad2 100644 --- a/build/appprotect/DockerfileWithAppProtectForPlusForOpenShift +++ b/build/appprotect/DockerfileWithAppProtectForPlusForOpenShift @@ -83,13 +83,13 @@ RUN mkdir -p /var/lib/nginx \ && mkdir -p /var/log/app_protect \ && mkdir -p /opt/app_protect \ && chown -R nginx:0 /etc/app_protect \ - /usr/share/ts \ - /etc/nginx \ - /var/cache/nginx \ - /var/lib/nginx/ \ - /var/log/app_protect/ \ - /opt/app_protect/ \ - /var/log/nginx/ \ + /usr/share/ts \ + /etc/nginx \ + /var/cache/nginx \ + /var/lib/nginx/ \ + /var/log/app_protect/ \ + /opt/app_protect/ \ + /var/log/nginx/ \ && rm /etc/nginx/conf.d/* RUN printf "MODULE = ALL;\nLOG_LEVEL = TS_CRIT;\nFILE = 2;\n" > /etc/app_protect/bd/logger.cfg \ diff --git a/build/openshift/Dockerfile b/build/openshift/Dockerfile index 2076332204..c2c3ae8f95 100644 --- a/build/openshift/Dockerfile +++ b/build/openshift/Dockerfile @@ -27,8 +27,8 @@ RUN set -x \ && setcap 'cap_net_bind_service=+ep' /usr/sbin/nginx \ && setcap 'cap_net_bind_service=+ep' /usr/sbin/nginx-debug \ && chown -R nginx:0 /etc/nginx \ - /var/cache/nginx \ - /var/lib/nginx \ + /var/cache/nginx \ + /var/lib/nginx \ && rm /etc/yum.repos.d/nginx.repo \ && rm /etc/nginx/conf.d/* diff --git a/build/openshift/DockerfileForPlus b/build/openshift/DockerfileForPlus index 2ed8b504ed..ba6c16911d 100644 --- a/build/openshift/DockerfileForPlus +++ b/build/openshift/DockerfileForPlus @@ -62,8 +62,8 @@ RUN mkdir -p /var/lib/nginx \ && mkdir -p /etc/nginx/secrets \ && mkdir -p /etc/nginx/stream-conf.d \ && chown -R nginx:0 /etc/nginx \ - /var/cache/nginx \ - /var/lib/nginx/ \ + /var/cache/nginx \ + /var/lib/nginx/ \ && rm /etc/nginx/conf.d/* EXPOSE 80 443