Created
March 16, 2020 08:11
-
-
Save kdankov/c72b1cd763649e559f441a246b5086b5 to your computer and use it in GitHub Desktop.
Local Development with Docker
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3.7' | |
services: | |
db: | |
image: mysql:5.7 | |
volumes: | |
- db_data_dev:/var/lib/mysql | |
restart: always | |
environment: | |
MYSQL_ROOT_PASSWORD: localdev | |
MYSQL_DATABASE: localdev | |
MYSQL_USER: localdev | |
MYSQL_PASSWORD: localdev | |
ports: | |
- 3306:3306 | |
command: [ | |
'--default_authentication_plugin=mysql_native_password', | |
'--character-set-server=utf8mb4', | |
'--collation-server=utf8mb4_unicode_ci' | |
] | |
php: | |
build: | |
context: . | |
dockerfile: Dockerfile-php | |
depends_on: | |
- db | |
restart: always | |
volumes: | |
- ../:/var/www/html | |
ports: | |
- 9000:9000 | |
nginx: | |
image: nginx:latest | |
depends_on: | |
- php | |
restart: always | |
volumes: | |
- ./nginx/site.conf:/etc/nginx/conf.d/site.conf | |
- ../:/var/www/html | |
ports: | |
- "80:80" | |
cli: | |
depends_on: | |
- db | |
- php | |
image: wordpress:cli | |
environment: | |
WORDPRESS_DB_HOST: db:3306 | |
volumes: | |
- ../:/var/www/html | |
dbadmin: | |
depends_on: | |
- db | |
image: phpmyadmin/phpmyadmin | |
restart: always | |
ports: | |
- 8888:80 | |
environment: | |
MYSQL_ROOT_PASSWORD: testing | |
PMA_HOST: db | |
volumes: | |
db_data_dev: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM php:7.3-fpm | |
RUN docker-php-ext-install mysqli |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
index index.php index.html; | |
server_name localdev.com; | |
error_log /var/log/nginx/error.log; | |
access_log /var/log/nginx/access.log; | |
root /var/www/html; | |
location ~ \.php$ { | |
try_files $uri =404; | |
fastcgi_split_path_info ^(.+\.php)(/.+)$; | |
fastcgi_pass php:9000; | |
fastcgi_index index.php; | |
include fastcgi_params; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
fastcgi_param PATH_INFO $fastcgi_path_info; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment