From a1c948f57f6101dc7ae72d6264babbad288976a5 Mon Sep 17 00:00:00 2001 From: Wilton Rodrigues Date: Sat, 30 Oct 2021 11:23:24 -0300 Subject: [PATCH] Improving the Dockerfile - Configure Apache2 to output Logs to stdout and stderr - Based on https://github.com/docker-library/httpd/blob/5f92ab18146f41d1d324e99c5e197bdeda65d063/2.4/Dockerfile#L202 - Remove unecessary layers to WORKDIR and using directory params --- 2.9/Dockerfile | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/2.9/Dockerfile b/2.9/Dockerfile index f0585c7..d8f4ca4 100644 --- a/2.9/Dockerfile +++ b/2.9/Dockerfile @@ -18,8 +18,6 @@ ENV APACHE_RUN_USER=apache APACHE_RUN_GROUP=apache \ VOLUME /var/lib/ocsinventory-reports /etc/ocsinventory-server /usr/share/ocsinventory-reports/ocsreports/extensions -WORKDIR /tmp - RUN yum ${YUM_FLAGS} install wget \ curl \ yum-utils \ @@ -65,17 +63,23 @@ RUN yum ${YUM_FLAGS} install wget \ php73-php-zip \ php73-php-opcache ; -RUN wget https://github.com/OCSInventory-NG/OCSInventory-ocsreports/releases/download/${OCS_VERSION}/OCSNG_UNIX_SERVER-${OCS_VERSION}.tar.gz && \ - tar xzf OCSNG_UNIX_SERVER-${OCS_VERSION}.tar.gz ; +RUN wget https://github.com/OCSInventory-NG/OCSInventory-ocsreports/releases/download/${OCS_VERSION}/OCSNG_UNIX_SERVER-${OCS_VERSION}.tar.gz -P /tmp && \ + tar xzf /tmp/OCSNG_UNIX_SERVER-${OCS_VERSION}.tar.gz -C /tmp; -WORKDIR /tmp/OCSNG_UNIX_SERVER-${OCS_VERSION} - -RUN cd Apache/ && \ +RUN cd /tmp/OCSNG_UNIX_SERVER-${OCS_VERSION}/Apache/ && \ perl Makefile.PL && \ make && \ make install ; -WORKDIR /tmp +WORKDIR /etc/httpd/conf.d + +# Redirect Apache2 Logs to stdout e stderr +# https://github.com/docker-library/httpd/blob/5f92ab18146f41d1d324e99c5e197bdeda65d063/2.4/Dockerfile#L202 +RUN sed -ri \ + -e 's!^(\s*CustomLog)\s+\S+!\1 /proc/self/fd/1!g' \ + -e 's!^(\s*ErrorLog)\s+\S+!\1 /proc/self/fd/2!g' \ + -e 's!^(\s*TransferLog)\s+\S+!\1 /proc/self/fd/1!g' \ + "/etc/httpd/conf/httpd.conf" COPY conf/ /tmp/conf COPY ./scripts/docker-entrypoint.sh /usr/bin/docker-entrypoint.sh