Skip to content
Snippets Groups Projects
Commit 21cae0d5 authored by Pierre Ozoux's avatar Pierre Ozoux
Browse files

Adds nginx php

parent fa649894
No related branches found
No related tags found
No related merge requests found
FROM nginx
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && apt-get install -y \
mysql-client \
php5-fpm \
php5-mysql \
curl && \
rm -rf /var/lib/apt/lists/* && \
rm -rf /etc/nginx/conf.d/* && \
rm -rf /usr/share/nginx/html/* && \
mkdir -p /etc/nginx/external && \
sed -i 's/access_log.*/access_log \/dev\/stdout;/g' /etc/nginx/nginx.conf && \
sed -i 's/error_log.*/error_log \/dev\/stdout info;/g' /etc/nginx/nginx.conf && \
sed -i 's/^pid/daemon off;\npid/g' /etc/nginx/nginx.conf && \
sed -i 's/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/g' /etc/php5/fpm/php.ini
ADD basic.conf /etc/nginx/conf.d/basic.conf
ADD entrypoint.sh /opt/entrypoint.sh
RUN chmod u+x /opt/entrypoint.sh
ADD mysql-check.sh /opt/mysql-check.sh
RUN chmod u+x /opt/mysql-check.sh
ADD environment /etc/environment
ENTRYPOINT ["/opt/entrypoint.sh"]
CMD ["nginx"]
# hide nginx version
server_tokens off;
# add nosniff header (https://www.owasp.org/index.php/List_of_useful_HTTP_headers)
add_header X-Content-Type-Options nosniff;
#!/bin/bash -eux
/etc/init.d/php5-fpm start
chmod a+rwx /var/run/php5-fpm.sock
echo "127.0.0.1 ${URL}" >> /etc/hosts
# exec CMD
echo ">> exec docker CMD"
echo "$@"
"$@"
#!/bin/bash -eux
DB_HOST=db
DB_PORT=${DB_PORT_3306_TCP_PORT:-${DB_PORT}}
DB_PORT=${DB_1_PORT_3306_TCP_PORT:-${DB_PORT}}
#!/bin/bash -eux
source /etc/environment
echo "=> Trying to connect to MySQL/MariaDB using:"
echo "========================================================================"
echo " Database Host Address: $DB_HOST"
echo " Database Port number: $DB_PORT"
echo " Database Username: $DB_USER"
echo " Database Password: $DB_PASS"
echo "========================================================================"
for ((i=0;i<10;i++))
do
DB_CONNECTABLE=$(mysql -u$DB_USER -p$DB_PASS -h$DB_HOST -P$DB_PORT -e 'status' >/dev/null 2>&1; echo "$?")
if [[ DB_CONNECTABLE -eq 0 ]]; then
exit 0
fi
sleep 5
done
exit 1
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment