Skip to content

Commit

Permalink
First commit
Browse files Browse the repository at this point in the history
  • Loading branch information
jsmsalt2 committed Mar 26, 2017
0 parents commit 98345e1
Show file tree
Hide file tree
Showing 6 changed files with 137 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/mysql-data/
53 changes: 53 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
redis:
container_name: redis
image: redis:3.0.7
ports:
- 6379:6379

mysql:
container_name: mysql
image: mariadb:10.1.21
ports:
- 3306:3306
volumes:
- ~/.docker-php/mysql-data:/var/lib/mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: root

nginx:
container_name: nginx
image: nginx:1.11.10
ports:
- 80:80
- 443:443
restart: always
volumes:
- ~/.docker-php/nginx-config/conf.d:/etc/nginx/conf.d
- ~/Projects:/code
links:
- php

php:
container_name: php
build: php-build
expose:
- 9000
restart: always
volumes:
- ~/.docker-php/php-config/php.ini:/usr/local/etc/php/conf.d/custom.ini
- ~/Projects:/code
links:
- mysql
- redis

phpmyadmin:
container_name: phpmyadmin
image: phpmyadmin/phpmyadmin:4.6.6-2
restart: always
links:
- mysql
ports:
- 8080:80
environment:
PMA_HOST: mysql
20 changes: 20 additions & 0 deletions nginx-config/conf.d/default.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
server {
listen 80 default_server;
server_name localhost _;
index index.php index.html index.htm;
root /code;

location / {
try_files $uri $uri/ /index.php?$query_string;
autoindex on;
}

location ~ \.php$ {
try_files $uri /index.php =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass php:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
27 changes: 27 additions & 0 deletions php-build/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
FROM php:7.1.2-fpm

RUN apt-get update && apt-get install -y \
libfreetype6-dev \
libjpeg62-turbo-dev \
libmcrypt-dev \
libpng12-dev \
zlib1g-dev \
libzmq-dev

RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
&& docker-php-ext-install gd

RUN docker-php-ext-install iconv mcrypt

RUN docker-php-ext-install mysqli

RUN docker-php-ext-install pdo pdo_mysql

RUN pecl install --onlyreqdeps --force redis \
&& rm -rf /tmp/pear \
&& docker-php-ext-enable redis

RUN pecl install zmq-beta \
&& docker-php-ext-enable zmq

CMD ["php-fpm"]
4 changes: 4 additions & 0 deletions php-config/php.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
display_errors = On
display_startup_errors = On
default_charset = "UTF-8"
html_errors = On
32 changes: 32 additions & 0 deletions zshrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
function docker-php() {
action=$1
app=$2

if [[ -z $action || -z $app ]]; then
echo "Necesitas especificar los parametros"
else
if [ "up" = "$action" ]; then
if [[ ! -a ~/Projects/$app/docker.yml ]]; then
echo "La aplicación no tiene archivo dock.yml."
else
docker-compose -f ~/.docker-php/docker-compose.yml -f ~/Projects/$app/docker.yml up -d
fi
elif [ "down" = "$action" ]; then
if [[ ! -a ~/Projects/$app/docker.yml ]]; then
echo "La aplicación no tiene archivo dock.yml."
else
docker-compose -f ~/.docker-php/docker-compose.yml -f ~/Projects/$app/docker.yml stop
docker-compose -f ~/.docker-php/docker-compose.yml -f ~/Projects/$app/docker.yml rm -v
fi
elif [ "remove" = "$action" ]; then
if [ "images" = "$app" ]; then
docker rmi $(docker images -q)
elif [ "containers" = "$app" ]; then
docker stop $(docker ps -a -q)
docker rm $(docker ps -a -q) -f -v
docker-compose -f ~/.docker-php/docker-compose.yml rm -v
fi
fi
fi

}

0 comments on commit 98345e1

Please sign in to comment.