Skip to content

Instantly share code, notes, and snippets.

@chateaux
Last active June 12, 2020 12:23
Show Gist options
  • Save chateaux/7bfaff76ff373d301eaca7ab09c2ecd1 to your computer and use it in GitHub Desktop.
Save chateaux/7bfaff76ff373d301eaca7ab09c2ecd1 to your computer and use it in GitHub Desktop.
#https://medium.com/swlh/wordpress-deployment-with-nginx-php-fpm-and-mariadb-using-docker-compose-55f59e5c1a
Access the bash
docker exec -t -i zf-docker_zf-project_1 /bin/bash
Start up the containers
sudo docker-compose up -d
Switch off the containers
sudo docker-compose down
#Work in progress
version: '3'
services:
mysql:
image: mariadb
volumes:
- ./data/mysql:/var/lib/mysql #Store mysql files in the docker/data/mysql directory
- ../application/docker/dump.sql:/docker-entrypoint-initdb.d/dump.sql
environment:
MYSQL_ROOT_PASSWORD: scrrratch_local
MYSQL_DATABASE: scrrratch_local
MYSQL_USER: scrrratch_local
MYSQL_PASSWORD: scrrratch_local
ports:
- "3306:3306"
restart: always
web:
image: php:7.4-fpm-alpine
volumes:
- ../application:/var/www/local.scratch.com/public_html/application
- ./docker-entrypoint.sh:/var/www/local.scratch.com/public_html/application/docker/docker-entrypoint.sh
depends_on:
- mysql
environment:
MYSQL_ROOT_PASSWORD: scrrratch_local
MYSQL_DATABASE: scrrratch_local
MYSQL_USER: scrrratch_local
MYSQL_PASSWORD: scrrratch_local
command: ["php-fpm -F -R"]
entrypoint: /var/www/local.scratch.com/public_html/application/docker/docker-entrypoint.sh
links:
- mysql
restart: always
nginx:
image: nginx:alpine
volumes:
- ./nginx:/etc/nginx/conf.d
- ../application:/var/www/local.scratch.com/public_html/application
ports:
- 80:80
links:
- web
#!/bin/sh
docker-php-ext-install bcmath
apk add --no-cache icu-dev
docker-php-ext-install intl
docker-php-ext-install mysqli pdo pdo_mysql
apk add --update nodejs nodejs-npm
npm install -g bower
apk add --no-cache git
/var/www/local.scratch.com/public_html/application/bower install --allow-root
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
cd /var/www/local.scratch.com/public_html/application
/usr/local/bin/composer install -n
data for the database
server {
listen 80;
listen [::]:80;
access_log off;
root /var/www/local.scratch.com/public_html/application/public;
index index.php;
server_name local.scratch.com;
server_tokens off;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri /index.php?$args;
}
# pass the PHP scripts to FastCGI server listening on wordpress:9000
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass web:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
}
}
# pass the PHP scripts to FastCGI server listening on zf-project:9000
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass web:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
foastcgi_param SCRIPT_NAME $fastcgi_script_name;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment