Skip to content

Instantly share code, notes, and snippets.

@hilja
Created January 18, 2017 09:39
Show Gist options
  • Save hilja/1335a957d6f9fd62e7bdfc4096f3b8ef to your computer and use it in GitHub Desktop.
Save hilja/1335a957d6f9fd62e7bdfc4096f3b8ef to your computer and use it in GitHub Desktop.
Docker setup
#!/usr/bin/env bash
set -x
php-fpm
# MySQL stuff for development
service mysql start
mysql -uroot -e "create database wordpress";
mysql -uroot wordpress < /var/www/html/staging-db-2017-01-16.sql
# Set all directories to 775
find /var/www/html -type d -print0 | xargs -0 chmod 0775
# Set all directories to 644
find /var/www/html -type f -print0 | xargs -0 chmod 0644
# Set owner to all files
chown -R root:www-data /var/www/html
cat << EOF > /var/www/html/local-config.php
<?php
define('DB_NAME', 'wordpress');
define('DB_USER', 'root');
define('DB_PASSWORD', '');
define('DB_HOST', '127.0.0.1');
define('WP_DEBUG', true);
ini_set('display_errors', 1);
define('WP_DEBUG_DISPLAY', true);
EOF
nginx -g 'daemon off;'
FROM php:7-fpm
ENV DEBIAN_FRONTEND=noninteractive
RUN pecl install xdebug-2.5.0 && docker-php-ext-enable xdebug
RUN apt-get update && \
apt-get install -y nginx vim psmisc mysql-server php5-mysql
RUN docker-php-ext-install mysqli pdo pdo_mysql
COPY ./htdocs /var/www/html
COPY ./build-tools/docker-cmd.sh ./
COPY ./conf/php/zz-docker.conf /usr/local/etc/php-fpm.d/
COPY ./conf/php/php-fpm.conf /usr/local/etc/
COPY ./conf/php/php.ini /usr/local/etc/php/
COPY ./conf/nginx/nginx.conf /etc/nginx/
COPY ./conf/nginx//sites-available/n26.com.docker.conf /etc/nginx/sites-available/default
EXPOSE 80
CMD ./docker-cmd.sh
#xdebug.remote_autostart=0
#xdebug.remote_enable=0
xdebug.auto_trace=1
xdebug.default_enable=0
xdebug.cli_color=0
xdebug.trace_format=2
xdebug.collect_params=3
xdebug.trace_output_dir=/tmp
xdebug.force_display_errors=0
xdebug.force_display_errors=0
xdebug.show_error_trace=0
mysql.default_socket = /var/run/mysqld/mysqld.sock
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment