Changing how container starts

- Using best practices from https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#entrypoint
- This way, the apache proccess will be PID 1
- It can simply start Apache2
- Or run Apache2 and pass parameters to the Server
This commit is contained in:
Wilton Rodrigues 2021-10-30 11:16:18 -03:00
parent 0acb4d800e
commit 5ed05a5946
2 changed files with 7 additions and 5 deletions

View File

@ -71,7 +71,7 @@ RUN wget https://github.com/OCSInventory-NG/OCSInventory-ocsreports/releases/dow
WORKDIR /tmp/OCSNG_UNIX_SERVER-${OCS_VERSION}
RUN cd Apache/ && \
perl Makefile.PL && \
perl Makefile.PL && \
make && \
make install ;
@ -82,4 +82,6 @@ COPY ./scripts/docker-entrypoint.sh /usr/bin/docker-entrypoint.sh
EXPOSE 80 443
# https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#entrypoint
ENTRYPOINT ["/usr/bin/docker-entrypoint.sh"]
CMD ["/usr/sbin/httpd", "-DFOREGROUND"]

View File

@ -22,7 +22,7 @@ if [ ! -f $OCS_WEBCONSOLE_DIR/ocsreports/var.php ]; then
cp -r /tmp/OCSNG_UNIX_SERVER-2.9/ocsreports/ ${OCS_WEBCONSOLE_DIR}
rm -rf ${OCS_WEBCONSOLE_DIR}/ocsreports/dbconfig.inc.php
fi;
if [ ! -z ${OCS_DISABLE_COM_MODE+x} ]; then
echo
echo "+---------------------------------------------------------------------------+"
@ -43,7 +43,7 @@ if [ ! -z ${OCS_DISABLE_WEB_MODE+x} ]; then
echo
fi
# Configure z-ocsinventory-server file
# Configure z-ocsinventory-server file
if [ ! -f /etc/httpd/conf.d/z-ocsinventory-server.conf ] && [ -z ${OCS_DISABLE_COM_MODE+x} ]; then
cp /tmp/conf/ocsinventory-server.conf /etc/httpd/conf.d/z-ocsinventory-server.conf
sed -i 's/VERSION_MP/2/g' /etc/httpd/conf.d/z-ocsinventory-server.conf
@ -74,7 +74,7 @@ if [ -f ${SRV_CONF_FILE} ] && [ -z ${OCS_DISABLE_COM_MODE+x} ]; then
done
fi
# Configure ocsinventory-reports file
# Configure ocsinventory-reports file
if [ ! -f /etc/httpd/conf.d/ocsinventory-reports.conf ] && [ -z ${OCS_DISABLE_WEB_MODE+x} ]; then
cp /tmp/conf/ocsinventory-reports.conf /etc/httpd/conf.d/ocsinventory-reports.conf
sed -i 's/OCSREPORTS_ALIAS/\/ocsreports/g' /etc/httpd/conf.d/ocsinventory-reports.conf
@ -137,4 +137,4 @@ echo "| Starting OCS Inventory NG Management Docker... |"
echo "+----------------------------------------------------------+"
echo
/usr/sbin/httpd -DFOREGROUND
exec "$@"