Skip to content

Commit

Permalink
Use chown(8) only once.
Browse files Browse the repository at this point in the history
It's possible to pass multiple files to chown utility, so run it
only once to make changes.
  • Loading branch information
osokin committed Dec 3, 2020
1 parent 4841668 commit 03e3e27
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 28 deletions.
4 changes: 2 additions & 2 deletions build/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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/*
Expand Down
4 changes: 2 additions & 2 deletions build/DockerfileForAlpine
Original file line number Diff line number Diff line change
Expand Up @@ -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/*
Expand Down
4 changes: 2 additions & 2 deletions build/DockerfileForPlus
Original file line number Diff line number Diff line change
Expand Up @@ -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/*

Expand Down
4 changes: 2 additions & 2 deletions build/DockerfileWithOpentracing
Original file line number Diff line number Diff line change
Expand Up @@ -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/*
Expand Down
4 changes: 2 additions & 2 deletions build/DockerfileWithOpentracingForPlus
Original file line number Diff line number Diff line change
Expand Up @@ -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/*

Expand Down
14 changes: 7 additions & 7 deletions build/appprotect/DockerfileWithAppProtectForPlus
Original file line number Diff line number Diff line change
Expand Up @@ -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/*

Expand Down
14 changes: 7 additions & 7 deletions build/appprotect/DockerfileWithAppProtectForPlusForOpenShift
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
4 changes: 2 additions & 2 deletions build/openshift/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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/*

Expand Down
4 changes: 2 additions & 2 deletions build/openshift/DockerfileForPlus
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 03e3e27

Please sign in to comment.