diff --git a/app.dockerfile b/app.dockerfile new file mode 100644 index 0000000..b3b92c5 --- /dev/null +++ b/app.dockerfile @@ -0,0 +1,16 @@ +FROM php:7.1.3-fpm + +RUN apt-get update +RUN apt-get install -y libmcrypt-dev +RUN apt-get install -y mysql-client +RUN pecl install imagick +RUN docker-php-ext-enable imagick +RUN docker-php-ext-install mcrypt pdo_mysql +RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" +RUN php -r "if (hash_file('SHA384', 'composer-setup.php') === '544e09ee996cdf60ece3804abc52599c22b1f40f4323403c44d44fdfdd586475ca9813a858088ffbc1f233e9b180f061') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" +RUN php composer-setup.php +RUN php -r "unlink('composer-setup.php');" +RUN mv composer.phar /usr/local/bin/composer +RUN apt-get install -y git +RUN apt-get update && apt-get install -y zlib1g-dev +RUN docker-php-ext-install zip \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..fcc7e66 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,34 @@ +version: '3' +services: + app: + build: + context: ./ + dockerfile: app.dockerfile + working_dir: /var/www + volumes: + - ./../laravel:/var/www + environment: + - "DB_PORT=3306" + - "DB_HOST=database" + web: + build: + context: ./ + dockerfile: web.dockerfile + working_dir: /var/www + volumes: + - ./../laravel:/var/www + ports: + - 8080:80 + database: + image: mysql:5.6 + volumes: + - dbdata:/var/lib/mysql + environment: + - "MYSQL_DATABASE=homestead" + - "MYSQL_USER=homestead" + - "MYSQL_PASSWORD=secret" + - "MYSQL_ROOT_PASSWORD=secret" + ports: + - "33061:3306" +volumes: + dbdata: \ No newline at end of file diff --git a/vhost.conf b/vhost.conf new file mode 100644 index 0000000..28019d2 --- /dev/null +++ b/vhost.conf @@ -0,0 +1,18 @@ +server { + listen 80; + index index.php index.html; + root /var/www/public; + +location / { + try_files $uri /index.php?$args; + } + +location ~ \.php$ { + fastcgi_split_path_info ^(.+\.php)(/.+)$; + fastcgi_pass app:9000; + fastcgi_index index.php; + include fastcgi_params; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + fastcgi_param PATH_INFO $fastcgi_path_info; + } +} \ No newline at end of file diff --git a/web.dockerfile b/web.dockerfile new file mode 100644 index 0000000..c4f5860 --- /dev/null +++ b/web.dockerfile @@ -0,0 +1,3 @@ +FROM nginx:1.14 + +ADD vhost.conf /etc/nginx/conf.d/default.conf \ No newline at end of file