Advertisement
Guest User

Untitled

a guest
Jan 14th, 2020
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.25 KB | None | 0 0
  1. ### docker-compose.yml
  2. version: '3'
  3. services:
  4.   php-fpm:
  5.     build:
  6.       context: docker/php
  7.     volumes:
  8.       - ./www:/var/www/mysite.local/public
  9.       - ./storage:/var/www/mysite.local/storage
  10.     environment:
  11.       XDEBUG_CONFIG: "remote_host=192.168.220.1 remote_enable=1"
  12.       PHP_IDE_CONFIG: "serverName=Docker"
  13.     networks:
  14.       - internal
  15.   nginx:
  16.     image: nginx:alpine
  17.     volumes:
  18.       - ./www:/var/www/mysite.local/public
  19.       - ./storage:/var/www/mysite.local/storage
  20.       - ./docker/nginx/mysite.local.conf:/etc/nginx/conf.d/default.conf
  21.       - ./docker/logs:/var/log/nginx/
  22.     ports:
  23.       - "80:80"
  24.     depends_on:
  25.       - php-fpm
  26.     networks:
  27.       - internal
  28.   mysql:
  29.     image: mysql:5.7
  30.     ports:
  31.       - "3306:3306"
  32.     volumes:
  33.       - ./mysql:/var/lib/mysql
  34.     environment:
  35.       MYSQL_ROOT_PASSWORD: secret
  36. networks:
  37.   internal:
  38.     driver: bridge
  39.     ipam:
  40.       driver: default
  41.       config:
  42.         - subnet: 192.168.220.0/28
  43.  
  44.  
  45. ### nginx/mysite.local.conf
  46. server {
  47.     listen 80;
  48.     index index.php index.html;
  49.     server_name 127.0.0.1 localhost;
  50.     root /var/www/mysite.local/public;
  51.     error_log  /var/log/nginx/error.log;
  52.     access_log /var/log/nginx/access.log;
  53.  
  54.   location / {
  55.         try_files $uri /index.php?$args;
  56.     }
  57.  
  58.     location ~ \.php$ {
  59.         fastcgi_split_path_info ^(.+\.php)(/.+)$;
  60.         fastcgi_pass php-fpm:9000;
  61.         fastcgi_index index.php;
  62.         fastcgi_read_timeout 1000;
  63.         include fastcgi_params;
  64.         fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  65.         fastcgi_param PATH_INFO $fastcgi_path_info;
  66.     }
  67. }
  68.  
  69.  
  70. ### php/Dockerfile
  71. FROM php:7.2-fpm
  72. WORKDIR /var/www/mysite.local
  73.  
  74. COPY ./php.ini /usr/local/etc/php/
  75.  
  76. RUN apt-get update && apt-get install -y wget git unzip \
  77.         bash \
  78.         gcc \
  79.         g++ \
  80.         make \
  81.         curl \
  82.         git \
  83.         wget \
  84.         grep \
  85.     && pecl install -of xdebug \
  86.     && docker-php-ext-install pdo \
  87.     && docker-php-ext-install -j$(nproc) iconv mbstring mysqli pdo_mysql \
  88.     && pecl install -of pecl_http \
  89.  
  90. RUN wget https://getcomposer.org/installer -O - -q \
  91.     | php -- --install-dir=/bin --filename=composer --quiet
  92.  
  93. CMD ["php-fpm"]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement