Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ### docker-compose.yml
- version: '3'
- services:
- php-fpm:
- build:
- context: docker/php
- volumes:
- - ./www:/var/www/mysite.local/public
- - ./storage:/var/www/mysite.local/storage
- environment:
- XDEBUG_CONFIG: "remote_host=192.168.220.1 remote_enable=1"
- PHP_IDE_CONFIG: "serverName=Docker"
- networks:
- - internal
- nginx:
- image: nginx:alpine
- volumes:
- - ./www:/var/www/mysite.local/public
- - ./storage:/var/www/mysite.local/storage
- - ./docker/nginx/mysite.local.conf:/etc/nginx/conf.d/default.conf
- - ./docker/logs:/var/log/nginx/
- ports:
- - "80:80"
- depends_on:
- - php-fpm
- networks:
- - internal
- mysql:
- image: mysql:5.7
- ports:
- - "3306:3306"
- volumes:
- - ./mysql:/var/lib/mysql
- environment:
- MYSQL_ROOT_PASSWORD: secret
- networks:
- internal:
- driver: bridge
- ipam:
- driver: default
- config:
- - subnet: 192.168.220.0/28
- ### nginx/mysite.local.conf
- server {
- listen 80;
- index index.php index.html;
- server_name 127.0.0.1 localhost;
- root /var/www/mysite.local/public;
- error_log /var/log/nginx/error.log;
- access_log /var/log/nginx/access.log;
- location / {
- try_files $uri /index.php?$args;
- }
- location ~ \.php$ {
- fastcgi_split_path_info ^(.+\.php)(/.+)$;
- fastcgi_pass php-fpm:9000;
- fastcgi_index index.php;
- fastcgi_read_timeout 1000;
- include fastcgi_params;
- fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
- fastcgi_param PATH_INFO $fastcgi_path_info;
- }
- }
- ### php/Dockerfile
- FROM php:7.2-fpm
- WORKDIR /var/www/mysite.local
- COPY ./php.ini /usr/local/etc/php/
- RUN apt-get update && apt-get install -y wget git unzip \
- bash \
- gcc \
- g++ \
- make \
- curl \
- git \
- wget \
- grep \
- && pecl install -of xdebug \
- && docker-php-ext-install pdo \
- && docker-php-ext-install -j$(nproc) iconv mbstring mysqli pdo_mysql \
- && pecl install -of pecl_http \
- RUN wget https://getcomposer.org/installer -O - -q \
- | php -- --install-dir=/bin --filename=composer --quiet
- CMD ["php-fpm"]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement