diff --git a/boilerplates/php.dev.boilerplate/docker-compose.yml b/boilerplates/php.dev.boilerplate/docker-compose.yml new file mode 100644 index 0000000000000000000000000000000000000000..14147dc88c5e9ec97ebfff8cd45518d5982f7872 --- /dev/null +++ b/boilerplates/php.dev.boilerplate/docker-compose.yml @@ -0,0 +1,50 @@ +version: "3" +services: + web: + image: canals/php + container_name: web + environment: + - VHOST_HOSTNAME=web.local + - VHOST_DOCROOT=/var/www/web + ports: + - "5080:80" + - "5543:443" + volumes : + - ./web:/var/www/web + - ./src:/var/www/src + - ./html:/var/www/html + links : + - mysql:db + + api: + image: canals/php + container_name: api + environment: + - VHOST_HOSTNAME=api.local + - VHOST_DOCROOT=/var/www/api + ports: + - "6080:80" + - "6443:443" + volumes : + - ./api:/var/www/api + - ./src:/var/www/src + - ./html:/var/www/html + links : + - mysql:db + + mysql: + image: mysql:5.6 + container_name: mysql + environment: + - MYSQL_ROOT_PASSWORD=root + - MYSQL_USER=user + - MYSQL_PASSWORD=user + ports: + - "3603:3306" + + adminer: + image: adminer + ports: + - "8080:8080" + links: + - mysql:db diff --git a/php.dev.boilerplate/docker-compose.yml b/php.dev.boilerplate/docker-compose.yml deleted file mode 100644 index 576b40493fd77c87c6563eb1d69b252a36123a52..0000000000000000000000000000000000000000 --- a/php.dev.boilerplate/docker-compose.yml +++ /dev/null @@ -1,30 +0,0 @@ -version: "3" -services: - web: - image: canals/php - container_name: web - ports: - - "5580:80" - - "5543:443" - volumes : - - ./web:/var/www/html - - ./src:/var/www/src - links : - - mysql:db - - mysql: - image: mysql:5.6 - container_name: mysql - environment: - - MYSQL_ROOT_PASSWORD=root - - MYSQL_USER=user - - MYSQL_PASSWORD=user - ports: - - "3603:3306" - - adminer: - image: adminer - ports: - - "8080:8080" - links: - - mysql:db diff --git a/php/5.6/Dockerfile b/php/5.6/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..5b0327d14f6c888e869adaab39d6a1518f1dc0b6 --- /dev/null +++ b/php/5.6/Dockerfile @@ -0,0 +1,59 @@ +# Use an official Python runtime as a base image +FROM php:5.6-apache + +RUN apt-get update && \ + apt-get install --yes --force-yes \ + cron g++ gettext libicu-dev openssl \ + libc-client-dev libkrb5-dev \ + libxml2-dev libfreetype6-dev \ + libgd-dev libmcrypt-dev bzip2 \ + libbz2-dev libtidy-dev libcurl4-openssl-dev \ + libz-dev libmemcached-dev libxslt-dev git-core + + +# PHP Configuration +RUN docker-php-ext-install bcmath &&\ + docker-php-ext-install bz2 && \ + docker-php-ext-install calendar && \ + docker-php-ext-install dba && \ + docker-php-ext-install exif &&\ + docker-php-ext-configure gd --with-freetype-dir=/usr --with-jpeg-dir=/usr &&\ + docker-php-ext-install gd &&\ + docker-php-ext-install gettext &&\ + docker-php-ext-configure imap --with-kerberos --with-imap-ssl &&\ + docker-php-ext-install imap &&\ + docker-php-ext-install intl &&\ + docker-php-ext-install mcrypt &&\ + docker-php-ext-install pdo pdo_mysql &&\ + docker-php-ext-install soap &&\ + docker-php-ext-install tidy &&\ + docker-php-ext-install xmlrpc &&\ + docker-php-ext-install mbstring &&\ + docker-php-ext-install xsl &&\ + docker-php-ext-install zip &&\ + docker-php-ext-configure hash --with-mhash &&\ + pecl install xdebug && docker-php-ext-enable xdebug &&\ + pecl install mongodb && docker-php-ext-enable mongodb &&\ + curl -sS https://getcomposer.org/installer | php \ + && mv composer.phar /usr/bin/composer + +# Apache Configuration +RUN a2enmod rewrite + +# SSL +RUN mv /etc/apache2/sites-available/default-ssl.conf /etc/apache2/sites-available/000-default-ssl.conf &&\ + a2enmod ssl && \ + a2ensite 000-default-ssl &&\ + openssl req -subj '/CN=example.com/O=My Company Name LTD./C=US' -new -newkey rsa:2048 -days 365 -nodes -x509 -keyout /etc/ssl/private/ssl-cert-snakeoil.key -out /etc/ssl/certs/ssl-cert-snakeoil.pem + +EXPOSE 443 + +# Imagemagick +RUN apt-get install --yes --force-yes libmagickwand-dev libmagickcore-dev +RUN yes '' | pecl install -f imagick &&\ + docker-php-ext-enable imagick + +COPY create_vhost start /usr/local/bin/ +COPY php.ini /usr/local/etc/php/ + +CMD ["start"] \ No newline at end of file diff --git a/php/5.6/README.md b/php/5.6/README.md new file mode 100644 index 0000000000000000000000000000000000000000..a0f4e821fee7e2fea82340bb90ce8eeee6ee481d --- /dev/null +++ b/php/5.6/README.md @@ -0,0 +1,9 @@ +# canals/php + +**a PHP docker image for pedagogical purposes** + + + +```bash +$ docker run -d --name vhost-php -e "VHOST_HOSTNAME=vost.php.local" -e "VHOST_DOCROOT=/var/www/vost" -p 9080:80 -p 9443:443 -v /Users/canals/dev/docker-test/test-php/api:/var/www/vost -v /Users/canals/dev/docker-test/test-php/src:/var/www/src canals/php:v2 +``` \ No newline at end of file diff --git a/php/5.6/create_vhost b/php/5.6/create_vhost new file mode 100755 index 0000000000000000000000000000000000000000..25fa2d38f4c86f4b8b2d6973e78d8d32d7637430 --- /dev/null +++ b/php/5.6/create_vhost @@ -0,0 +1,159 @@ +#!/usr/bin/env bash + +function show_usage { +cat <<- _EOF_ + +Create a new vHost in Debian/Ubuntu Server +Assumes /etc/apache2/sites-available and /etc/apache2/sites-enabled setup used + + -d DocumentRoot - i.e. /var/www/yoursite + -h Help - Show this menu. + -n ServerName - i.e. example.com or sub.example.com + -a ServerAlias - i.e. *.example.com or another domain altogether + -s ssl flag : if set to "yes", generate a key/certificate and enables ssl for the vhost + -c Certificate filename. "xip.io" becomes "xip.io.key" and "xip.io.crt". + if not set, the server name is used as a cert. name + Example Usage. + sudo create_vhost -d /var/www/api -n api.dev.local -s yes +_EOF_ +exit 1 +} +# +# Output vHost skeleton, fill with userinput +# To be outputted into new file +# +function create_vhost { +cat <<- _EOF_ +<VirtualHost *:80> + ServerAdmin webmaster@localhost + ServerName $ServerName + $ServerAlias + DocumentRoot $DocumentRoot + <Directory $DocumentRoot> + Options +Indexes +FollowSymLinks +MultiViews + AllowOverride All + Require all granted + #<FilesMatch \.php$> + # Change this "proxy:unix:/path/to/fpm.socket" + # if using a Unix socket + # SetHandler "proxy:fcgi://127.0.0.1:9000" + #</FilesMatch> + </Directory> + ErrorLog \${APACHE_LOG_DIR}/$ServerName-error.log + # Possible values include: debug, info, notice, warn, error, crit, + # alert, emerg. + LogLevel warn + CustomLog \${APACHE_LOG_DIR}/$ServerName-access.log combined +</VirtualHost> +_EOF_ +} +function create_ssl_vhost { +cat <<- _EOF_ +<IfModule mod_ssl.c> +<VirtualHost *:443> + ServerAdmin webmaster@localhost + ServerName $ServerName + $ServerAlias + DocumentRoot $DocumentRoot + <Directory $DocumentRoot> + Options +Indexes +FollowSymLinks +MultiViews + AllowOverride All + Require all granted + #<FilesMatch \.php$> + # Change this "proxy:unix:/path/to/fpm.socket" + # if using a Unix socket + # SetHandler "proxy:fcgi://127.0.0.1:9000" + #</FilesMatch> + </Directory> + ErrorLog \${APACHE_LOG_DIR}/$ServerName-error.log + # Possible values include: debug, info, notice, warn, error, crit, + # alert, emerg. + LogLevel warn + CustomLog \${APACHE_LOG_DIR}/$ServerName-access.log combined + SSLEngine on + SSLCertificateFile $CertPath/$CertName.pem + SSLCertificateKeyFile $KeyPath/$CertName.key + <FilesMatch "\.(cgi|shtml|phtml|php)$"> + SSLOptions +StdEnvVars + </FilesMatch> + <Directory /usr/lib/cgi-bin> + SSLOptions +StdEnvVars + </Directory> + BrowserMatch "MSIE [2-6]" \\ + nokeepalive ssl-unclean-shutdown \\ + downgrade-1.0 force-response-1.0 + # MSIE 7 and newer should be able to use keepalive + BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown +</VirtualHost> +</IfModule> +_EOF_ +} +#Sanity Check - are there two arguments with 2 values? +if [ "$#" -lt 4 ]; then + show_usage +fi +CertPath="/etc/ssl/certs" +KeyPath="/etc/ssl/private" +#WithSsl="no" +#Parse flags +while getopts "d:s:a:n:c:h" OPTION; do + case $OPTION in + h) + show_usage + ;; + d) + DocumentRoot=$OPTARG + ;; + n) + ServerName=$OPTARG + ;; + a) + Alias=$OPTARG + ;; + s) + WithSsl=$OPTARG + ;; + c) + CertName=$OPTARG + ;; + *) + show_usage + ;; + esac +done +# If alias is set: +if [ "$Alias" != "" ]; then + ServerAlias="ServerAlias "$Alias +else + ServerAlias="" +fi +# If CertName doesn't get set, set it to ServerName +if [ "$CertName" == "" ]; then + CertName=$ServerName +fi + +if [ ! -d $DocumentRoot ]; then + mkdir -p $DocumentRoot + #chown USER:USER $DocumentRoot #POSSIBLE IMPLEMENTATION, new flag -u ? +fi + +if [ -z "$WithSsl" ]; then + if [ -f "/etc/apache2/sites-enabled/$ServerName.conf" ]; then + echo 'vHost already exists. Aborting' + show_usage + else + create_vhost > /etc/apache2/sites-available/${ServerName}.conf + cd /etc/apache2/sites-available/ && a2ensite ${ServerName}.conf + fi +else + if [ -f "/etc/apache2/sites-enabled/$ServerName-ssl.conf" ]; then + echo 'vHost already exists. Aborting' + show_usage + else + create_ssl_vhost >> /etc/apache2/sites-available/${ServerName}-ssl.conf + fi + + # Enable Site + cd /etc/apache2/sites-available/ && a2ensite ${ServerName}-ssl.conf + #service apache2 reload +fi \ No newline at end of file diff --git a/php/5.6/php.ini b/php/5.6/php.ini new file mode 100644 index 0000000000000000000000000000000000000000..dd2cb8fa1492d984d856ac31b7edb3a2eacfea73 --- /dev/null +++ b/php/5.6/php.ini @@ -0,0 +1,25 @@ +[PHP] + + +memory_limit = 512M +max_execution_time = 60 +error_reporting = -1 +display_errors = On +display_startup_errors = On +track_errors = On +variables_order = "GPCS" + + +;;;;;;;;;;;;;;;; +; File Uploads ; +;;;;;;;;;;;;;;;; + +file_uploads = On +upload_max_filesize = 8M +max_file_uploads = 25 + +;;;;;;;;;;;;;;;;;; +; Fopen wrappers ; +;;;;;;;;;;;;;;;;;; +allow_url_fopen = Off +allow_url_include = Off diff --git a/php/5.6/start b/php/5.6/start new file mode 100755 index 0000000000000000000000000000000000000000..acc8ae22683c6203ca97bfe578fd7cc257254990 --- /dev/null +++ b/php/5.6/start @@ -0,0 +1,18 @@ +#!/usr/bin/env bash + +if [ -z "$VHOST_HOSTNAME" -o -z "$VHOST_DOCROOT" ]; then + echo "dont create vhost : hostname or docroot empty" +# +# +else +# echo "create : create_vhost -d $VHOST_DOCROOT -n $VHOST_HOSTNAME" + /usr/local/bin/create_vhost -d $VHOST_DOCROOT -n $VHOST_HOSTNAME +# echo "create cert : openssl req -subj '/CN=$VHOST_HOSTNAME/O=dev. team/C=fr' -new -newkey rsa:2048 -days 365 -nodes -x509 -keyout /etc/ssl/private/$VHOST_HOSTNAME.key -out /etc/ssl/certs/$VHOST_HOSTNAME.pem" + openssl req -subj '/CN=$VHOST_HOSTNAME/O=dev. team/C=fr' -new -newkey rsa:2048 -days 365 -nodes -x509 -keyout /etc/ssl/private/$VHOST_HOSTNAME.key -out /etc/ssl/certs/$VHOST_HOSTNAME.pem +# echo "create ssl vhost : create_vhost -d $VHOST_DOCROOT -s $VHOST_HOSTNAME" + /usr/local/bin/create_vhost -d $VHOST_DOCROOT -n $VHOST_HOSTNAME -s yes + +fi + +echo "start apache foreground" +apache2-foreground \ No newline at end of file diff --git a/php/Dockerfile b/php/7.1/Dockerfile similarity index 80% rename from php/Dockerfile rename to php/7.1/Dockerfile index a266eadb3915dbca13dfe17792dd69eb40dee5d2..109832fd140fdcc94d99ae7d07385b2c075e0444 100644 --- a/php/Dockerfile +++ b/php/7.1/Dockerfile @@ -33,23 +33,27 @@ RUN docker-php-ext-install bcmath &&\ docker-php-ext-install zip &&\ docker-php-ext-configure hash --with-mhash &&\ pecl install xdebug && docker-php-ext-enable xdebug &&\ - pecl install mongodb && docker-php-ext-enable mongodb - -# composer - -RUN curl -sS https://getcomposer.org/installer | php \ - && mv composer.phar /usr/bin/composer + pecl install mongodb && docker-php-ext-enable mongodb &&\ + curl -sS https://getcomposer.org/installer | php \ + && mv composer.phar /usr/bin/composer # Apache Configuration RUN a2enmod rewrite # SSL -RUN a2enmod ssl && \ - a2ensite default-ssl &&\ +RUN mv /etc/apache2/sites-available/default-ssl.conf /etc/apache2/sites-available/000-default-ssl.conf &&\ + a2enmod ssl && \ + a2ensite 000-default-ssl &&\ openssl req -subj '/CN=example.com/O=My Company Name LTD./C=US' -new -newkey rsa:2048 -days 365 -nodes -x509 -keyout /etc/ssl/private/ssl-cert-snakeoil.key -out /etc/ssl/certs/ssl-cert-snakeoil.pem -expose 443 +EXPOSE 443 + # Imagemagick RUN apt-get install --yes --force-yes libmagickwand-dev libmagickcore-dev RUN yes '' | pecl install -f imagick &&\ docker-php-ext-enable imagick + +COPY create_vhost start /usr/local/bin/ +COPY php.ini /usr/local/etc/php/ + +CMD ["start"] \ No newline at end of file diff --git a/php/7.1/README.md b/php/7.1/README.md new file mode 100644 index 0000000000000000000000000000000000000000..a0f4e821fee7e2fea82340bb90ce8eeee6ee481d --- /dev/null +++ b/php/7.1/README.md @@ -0,0 +1,9 @@ +# canals/php + +**a PHP docker image for pedagogical purposes** + + + +```bash +$ docker run -d --name vhost-php -e "VHOST_HOSTNAME=vost.php.local" -e "VHOST_DOCROOT=/var/www/vost" -p 9080:80 -p 9443:443 -v /Users/canals/dev/docker-test/test-php/api:/var/www/vost -v /Users/canals/dev/docker-test/test-php/src:/var/www/src canals/php:v2 +``` \ No newline at end of file diff --git a/php/7.1/create_vhost b/php/7.1/create_vhost new file mode 100755 index 0000000000000000000000000000000000000000..25fa2d38f4c86f4b8b2d6973e78d8d32d7637430 --- /dev/null +++ b/php/7.1/create_vhost @@ -0,0 +1,159 @@ +#!/usr/bin/env bash + +function show_usage { +cat <<- _EOF_ + +Create a new vHost in Debian/Ubuntu Server +Assumes /etc/apache2/sites-available and /etc/apache2/sites-enabled setup used + + -d DocumentRoot - i.e. /var/www/yoursite + -h Help - Show this menu. + -n ServerName - i.e. example.com or sub.example.com + -a ServerAlias - i.e. *.example.com or another domain altogether + -s ssl flag : if set to "yes", generate a key/certificate and enables ssl for the vhost + -c Certificate filename. "xip.io" becomes "xip.io.key" and "xip.io.crt". + if not set, the server name is used as a cert. name + Example Usage. + sudo create_vhost -d /var/www/api -n api.dev.local -s yes +_EOF_ +exit 1 +} +# +# Output vHost skeleton, fill with userinput +# To be outputted into new file +# +function create_vhost { +cat <<- _EOF_ +<VirtualHost *:80> + ServerAdmin webmaster@localhost + ServerName $ServerName + $ServerAlias + DocumentRoot $DocumentRoot + <Directory $DocumentRoot> + Options +Indexes +FollowSymLinks +MultiViews + AllowOverride All + Require all granted + #<FilesMatch \.php$> + # Change this "proxy:unix:/path/to/fpm.socket" + # if using a Unix socket + # SetHandler "proxy:fcgi://127.0.0.1:9000" + #</FilesMatch> + </Directory> + ErrorLog \${APACHE_LOG_DIR}/$ServerName-error.log + # Possible values include: debug, info, notice, warn, error, crit, + # alert, emerg. + LogLevel warn + CustomLog \${APACHE_LOG_DIR}/$ServerName-access.log combined +</VirtualHost> +_EOF_ +} +function create_ssl_vhost { +cat <<- _EOF_ +<IfModule mod_ssl.c> +<VirtualHost *:443> + ServerAdmin webmaster@localhost + ServerName $ServerName + $ServerAlias + DocumentRoot $DocumentRoot + <Directory $DocumentRoot> + Options +Indexes +FollowSymLinks +MultiViews + AllowOverride All + Require all granted + #<FilesMatch \.php$> + # Change this "proxy:unix:/path/to/fpm.socket" + # if using a Unix socket + # SetHandler "proxy:fcgi://127.0.0.1:9000" + #</FilesMatch> + </Directory> + ErrorLog \${APACHE_LOG_DIR}/$ServerName-error.log + # Possible values include: debug, info, notice, warn, error, crit, + # alert, emerg. + LogLevel warn + CustomLog \${APACHE_LOG_DIR}/$ServerName-access.log combined + SSLEngine on + SSLCertificateFile $CertPath/$CertName.pem + SSLCertificateKeyFile $KeyPath/$CertName.key + <FilesMatch "\.(cgi|shtml|phtml|php)$"> + SSLOptions +StdEnvVars + </FilesMatch> + <Directory /usr/lib/cgi-bin> + SSLOptions +StdEnvVars + </Directory> + BrowserMatch "MSIE [2-6]" \\ + nokeepalive ssl-unclean-shutdown \\ + downgrade-1.0 force-response-1.0 + # MSIE 7 and newer should be able to use keepalive + BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown +</VirtualHost> +</IfModule> +_EOF_ +} +#Sanity Check - are there two arguments with 2 values? +if [ "$#" -lt 4 ]; then + show_usage +fi +CertPath="/etc/ssl/certs" +KeyPath="/etc/ssl/private" +#WithSsl="no" +#Parse flags +while getopts "d:s:a:n:c:h" OPTION; do + case $OPTION in + h) + show_usage + ;; + d) + DocumentRoot=$OPTARG + ;; + n) + ServerName=$OPTARG + ;; + a) + Alias=$OPTARG + ;; + s) + WithSsl=$OPTARG + ;; + c) + CertName=$OPTARG + ;; + *) + show_usage + ;; + esac +done +# If alias is set: +if [ "$Alias" != "" ]; then + ServerAlias="ServerAlias "$Alias +else + ServerAlias="" +fi +# If CertName doesn't get set, set it to ServerName +if [ "$CertName" == "" ]; then + CertName=$ServerName +fi + +if [ ! -d $DocumentRoot ]; then + mkdir -p $DocumentRoot + #chown USER:USER $DocumentRoot #POSSIBLE IMPLEMENTATION, new flag -u ? +fi + +if [ -z "$WithSsl" ]; then + if [ -f "/etc/apache2/sites-enabled/$ServerName.conf" ]; then + echo 'vHost already exists. Aborting' + show_usage + else + create_vhost > /etc/apache2/sites-available/${ServerName}.conf + cd /etc/apache2/sites-available/ && a2ensite ${ServerName}.conf + fi +else + if [ -f "/etc/apache2/sites-enabled/$ServerName-ssl.conf" ]; then + echo 'vHost already exists. Aborting' + show_usage + else + create_ssl_vhost >> /etc/apache2/sites-available/${ServerName}-ssl.conf + fi + + # Enable Site + cd /etc/apache2/sites-available/ && a2ensite ${ServerName}-ssl.conf + #service apache2 reload +fi \ No newline at end of file diff --git a/php/7.1/php.ini b/php/7.1/php.ini new file mode 100644 index 0000000000000000000000000000000000000000..dd2cb8fa1492d984d856ac31b7edb3a2eacfea73 --- /dev/null +++ b/php/7.1/php.ini @@ -0,0 +1,25 @@ +[PHP] + + +memory_limit = 512M +max_execution_time = 60 +error_reporting = -1 +display_errors = On +display_startup_errors = On +track_errors = On +variables_order = "GPCS" + + +;;;;;;;;;;;;;;;; +; File Uploads ; +;;;;;;;;;;;;;;;; + +file_uploads = On +upload_max_filesize = 8M +max_file_uploads = 25 + +;;;;;;;;;;;;;;;;;; +; Fopen wrappers ; +;;;;;;;;;;;;;;;;;; +allow_url_fopen = Off +allow_url_include = Off diff --git a/php/7.1/start b/php/7.1/start new file mode 100755 index 0000000000000000000000000000000000000000..acc8ae22683c6203ca97bfe578fd7cc257254990 --- /dev/null +++ b/php/7.1/start @@ -0,0 +1,18 @@ +#!/usr/bin/env bash + +if [ -z "$VHOST_HOSTNAME" -o -z "$VHOST_DOCROOT" ]; then + echo "dont create vhost : hostname or docroot empty" +# +# +else +# echo "create : create_vhost -d $VHOST_DOCROOT -n $VHOST_HOSTNAME" + /usr/local/bin/create_vhost -d $VHOST_DOCROOT -n $VHOST_HOSTNAME +# echo "create cert : openssl req -subj '/CN=$VHOST_HOSTNAME/O=dev. team/C=fr' -new -newkey rsa:2048 -days 365 -nodes -x509 -keyout /etc/ssl/private/$VHOST_HOSTNAME.key -out /etc/ssl/certs/$VHOST_HOSTNAME.pem" + openssl req -subj '/CN=$VHOST_HOSTNAME/O=dev. team/C=fr' -new -newkey rsa:2048 -days 365 -nodes -x509 -keyout /etc/ssl/private/$VHOST_HOSTNAME.key -out /etc/ssl/certs/$VHOST_HOSTNAME.pem +# echo "create ssl vhost : create_vhost -d $VHOST_DOCROOT -s $VHOST_HOSTNAME" + /usr/local/bin/create_vhost -d $VHOST_DOCROOT -n $VHOST_HOSTNAME -s yes + +fi + +echo "start apache foreground" +apache2-foreground \ No newline at end of file diff --git a/php/test/README.md b/php/test/README.md new file mode 100644 index 0000000000000000000000000000000000000000..8126eb36bd48527afe413bb6634f8790a530b838 --- /dev/null +++ b/php/test/README.md @@ -0,0 +1,42 @@ +###Tests for the 7.1 and 5.6 php/apache images + +####php7.1 image : + +```shell +$ docker-compose -f docker-compose.test.7.1.yml up +Creating web.test.canals.php.7.1 +Attaching to web.test.canals.php.7.1 +... + +``` + +should lead to the creation and enaction of a container named _web.test.canals.php.7.1_ . + +To verify that everything goes well, just point your preferred browser to the following urls: +* http://localhost:25080/ +* http://localhost:25080/index.html +* http://localhost:25080/info.php +* https://localhost:25443/ +* https://localhost:25443/index.html +* https://localhost:25443/info.php + + +####php5.6 image : + +```shell +$ docker-compose -f docker-compose.test.5.6.yml up + Creating web.test.canals.php.5.6 + Attaching to web.test.canals.php.5.6 +... + +``` + +should lead to the creation and enaction of a container named _web.test.canals.php.7.1_ . + +To verify that everything goes well, just point your preferred browser to the following urls: +* http://localhost:26080/ +* http://localhost:26080/index.html +* http://localhost:26080/info.php +* https://localhost:26443/ +* https://localhost:26443/index.html +* https://localhost:26443/info.php \ No newline at end of file diff --git a/php/test/docker-compose.test.5.6.yml b/php/test/docker-compose.test.5.6.yml new file mode 100644 index 0000000000000000000000000000000000000000..9185882db8155e7f025a577d87f467a526f8773f --- /dev/null +++ b/php/test/docker-compose.test.5.6.yml @@ -0,0 +1,13 @@ +version: "3" +services: + web: + image: canals/php:5.6 + container_name: web.test.canals.php.5.6 + ports: + - "26080:80" + - "26443:443" + volumes : + - ./web:/var/www/html + - ./src:/var/www/src + + diff --git a/php/test/docker-compose.test.7.1.yml b/php/test/docker-compose.test.7.1.yml new file mode 100644 index 0000000000000000000000000000000000000000..1570543f6367aacab28931cb9d87795d8a20860a --- /dev/null +++ b/php/test/docker-compose.test.7.1.yml @@ -0,0 +1,13 @@ +version: "3" +services: + web: + image: canals/php + container_name: web.test.canals.php.7.1 + ports: + - "25080:80" + - "25443:443" + volumes : + - ./web:/var/www/html + - ./src:/var/www/src + + diff --git a/php/test/src/sample.php b/php/test/src/sample.php new file mode 100644 index 0000000000000000000000000000000000000000..9eec48d46496dab6e58629d91b2d181cb15cb937 --- /dev/null +++ b/php/test/src/sample.php @@ -0,0 +1,10 @@ +<?php +/** + * File: sample.php + * Creation Date: 23/06/2017 + * description: + * + * @author: canals + */ + +$sample ='hungry heart'; \ No newline at end of file diff --git a/php/test/web/index.html b/php/test/web/index.html new file mode 100644 index 0000000000000000000000000000000000000000..f479acf919f4f80401c9c19b04f8b69ce5fa4daf --- /dev/null +++ b/php/test/web/index.html @@ -0,0 +1,10 @@ +<!DOCTYPE html> +<html lang="fr"> +<head> + <meta charset="UTF-8"> + <title>it works !</title> +</head> +<body> + +</body> +</html> \ No newline at end of file diff --git a/php/test/web/index.php b/php/test/web/index.php new file mode 100644 index 0000000000000000000000000000000000000000..365327029127f02c9bb0d52a7c03040930a758bc --- /dev/null +++ b/php/test/web/index.php @@ -0,0 +1,17 @@ +<?php +/** + * File: index.php + * Creation Date: 23/06/2017 + * description: + * + * @author: canals + */ + +require_once __DIR__ . '/../src/sample.php'; + +echo <<<EOT +<!-- DOCTYPE html--> +<html> +<body> <h1> php is working ! </h1> <h2> sample : $sample</h2> +</html> +EOT; diff --git a/php/test/web/info.php b/php/test/web/info.php new file mode 100644 index 0000000000000000000000000000000000000000..8ac5c0523968f63faf7e972e2bedde4a043c474f --- /dev/null +++ b/php/test/web/info.php @@ -0,0 +1,10 @@ +<?php +/** + * File: info.php + * Creation Date: 23/06/2017 + * description: + * + * @author: canals + */ + +phpinfo(); \ No newline at end of file