add docker container for development environmet

This commit is contained in:
Roland Schneider 2018-02-06 08:06:43 +01:00
parent ee58366748
commit acb5b040c5
7 changed files with 140 additions and 0 deletions

2
docker/build.sh Normal file
View File

@ -0,0 +1,2 @@
#!/usr/bin/env bash
docker-compose build --force-rm --no-cache

View File

@ -0,0 +1,4 @@
version: '2'
services:
fitness-ub-php-7:
build: ./service/ub-php

View File

@ -0,0 +1,42 @@
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
# Always set these headers.
Header always set Access-Control-Allow-Origin "*"
Header always set Access-Control-Allow-Methods "POST, GET, OPTIONS, DELETE, PUT"
Header always set Access-Control-Max-Age "1000"
Header always set Access-Control-Allow-Headers "x-requested-with, Content-Type, origin, authorization, accept, client-security-token"
# Added a rewrite to respond with a 200 SUCCESS on every OPTIONS request.
RewriteEngine On
RewriteCond %{REQUEST_METHOD} OPTIONS
RewriteRule ^(.*)$ $1 [R=200,L]
</VirtualHost>

View File

@ -0,0 +1,59 @@
FROM ubuntu:16.04
MAINTAINER rocho02@gmail.com
# apt-get
RUN apt-get update \
&& apt-get -y install bzip2 git nano wget zip unzip curl vim \
&& apt-get -y install libmcrypt-dev libzzip-dev zziplib-bin zlib1g-dev \
&& apt-get -y install apache2
# && ufw allow in "Apache Full" \
RUN apt-get -y install php \
libapache2-mod-php \
php-mcrypt \
php-mysql \
php-xml \
php7.0-gd \
php7.0-mbstring
RUN apt-get -y install php-xdebug php-soap php-curl
RUN apt-get -y install \
# Required by composer
git \
zlib1g-dev \
--no-install-recommends
# Install composer
COPY install-composer /install-composer
RUN /install-composer && rm /install-composer
RUN mkdir -p /var/www/html/api && mkdir -p /var/www/html/admin && mkdir -p /var/www/html/public
WORKDIR /var/www
RUN a2enmod headers
RUN a2enmod rewrite
COPY 000-default.conf /etc/apache2/sites-available/
# Ports
EXPOSE 80
RUN FILE=/etc/php/7.0/apache2/php.ini \
&& echo "\n" >> $FILE \
&& echo "\n# Added for xdebug" >> $FILE \
&& echo "\nzend_extension=\"/usr/lib/php/20151012/xdebug.so\" " >> $FILE \
&& echo "\nxdebug.remote_enable=1 " >> $FILE \
&& echo "\nxdebug.remote_handler=dbgp " >> $FILE \
&& echo "\nxdebug.remote_mode=req " >> $FILE \
&& echo "\nxdebug.remote_host=172.17.0.1 " >> $FILE \
&& echo "\nxdebug.remote_port=9000 " >> $FILE \
&& echo "\nxdebug.remote_connect_back=1 " >> $FILE \
&& echo "\n" >> $FILE
ENV XDEBUG_CONFIG="idekey=PHPSTORM"
# Default command
CMD ["apachectl", "-D", "FOREGROUND"]

View File

@ -0,0 +1,17 @@
#!/bin/sh
EXPECTED_SIGNATURE=$(curl https://composer.github.io/installer.sig)
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
ACTUAL_SIGNATURE=$(php -r "echo hash_file('SHA384', 'composer-setup.php');")
if [ "$EXPECTED_SIGNATURE" != "$ACTUAL_SIGNATURE" ]
then
>&2 echo 'ERROR: Invalid installer signature'
rm composer-setup.php
exit 1
fi
php composer-setup.php --install-dir=/usr/bin --filename=composer
RESULT=$?
rm composer-setup.php
exit $RESULT

13
docker/start.sh Normal file
View File

@ -0,0 +1,13 @@
#!/usr/bin/env bash
PROJECT_DIR=$(pwd)/..
docker run \
-v ${PROJECT_DIR}:/var/www/html/fitness_web \
--rm \
-d \
-p 86:80 \
--name fitness-web \
--hostname test.fintess_web.hu \
-e XDEBUG_CONFIG="idekey=PHPSTORM" \
docker_fitness-ub-php-7:latest

3
start.sh Normal file
View File

@ -0,0 +1,3 @@
#!/usr/bin/env bash
./docker/start.sh