-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #78 from makasim/docker
Docker container.
- Loading branch information
Showing
21 changed files
with
1,485 additions
and
10 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.git | ||
!docker/container |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
FROM ubuntu:16.04 | ||
|
||
RUN mkdir -p /payum /var/log/payum /run/php | ||
|
||
## libs | ||
RUN apt-get update && \ | ||
apt-get install -y --no-install-recommends wget curl openssl ca-certificates nano && \ | ||
apt-get install -y --no-install-recommends php php-fpm php-mysql php-curl php-intl php-soap php-gd php-mbstring php-xml php-ldap php-zip php-mcrypt php-xdebug php-bcmath && \ | ||
apt-get install -y --no-install-recommends nginx && \ | ||
service nginx stop | ||
|
||
RUN apt-get install -y --no-install-recommends supervisor | ||
|
||
RUN apt-get install -y --no-install-recommends nodejs npm | ||
|
||
RUN rm -f /etc/php/7.0/fpm/pool.d/* && \ | ||
rm -f /etc/php/7.0/cli/conf.d/*xdebug.ini && \ | ||
rm -f /etc/nginx/sites-enabled/* | ||
|
||
COPY ./docker/container/php/payum_cli.ini /etc/php/7.0/cli/conf.d/1-payum_cli.ini | ||
COPY ./docker/container/php/payum_fpm.ini /etc/php/7.0/fpm/conf.d/1-payum_fpm.ini | ||
COPY ./docker/container/php/payum-fpm.conf /etc/php/7.0/fpm/pool.d/payum_fpm.conf | ||
COPY ./docker/container/nginx/payum.dev /etc/nginx/sites-enabled/payum.dev | ||
COPY ./docker/container/supervisor/payum_app.conf /etc/supervisor/conf.d/payum_app.conf | ||
COPY ./docker/container/bin/entrypoint.sh /entrypoint.sh | ||
COPY ./docker/container/phpstorm/ide-phpunit.php /usr/local/bin/ide-phpunit.php | ||
COPY ./docker/container/phpstorm/ide-phpinfo.php /usr/local/bin/ide-phpinfo.php | ||
|
||
WORKDIR /payum | ||
|
||
CMD /entrypoint.sh |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
version: '2' | ||
services: | ||
web: | ||
build: . | ||
ports: | ||
- "80:80" | ||
depends_on: | ||
- mongodb | ||
- mysql | ||
volumes: | ||
- .:${PAYUM_ROOT_DIR} | ||
- ${PAYUM_ROOT_DIR}/app/cache | ||
- ${PAYUM_ROOT_DIR}/app/logs | ||
environment: | ||
- PAYUM_ROOT_DIR=${PAYUM_ROOT_DIR} | ||
- SYMFONY__ENV_DATABASE_HOST=mysql | ||
- SYMFONY__ENV_DATABASE_PORT=3306 | ||
- SYMFONY__ENV_DATABASE_NAME=payum | ||
- SYMFONY__ENV_DATABASE_USER=root | ||
- SYMFONY__ENV_DATABASE_PASSWORD=rootpass | ||
- SYMFONY__ENV_MONGODB_HOST=mongodb | ||
- SYMFONY__ENV_MONGODB_PORT=27017 | ||
- SYMFONY__ENV_MONGODB_NAME=payum | ||
|
||
mysql: | ||
image: mariadb:10 | ||
ports: | ||
- "3306:3306" | ||
volumes: | ||
- ./docker/container/mysql:/etc/mysql/conf.d | ||
- mysql-data:/var/lib/mysql | ||
environment: | ||
MYSQL_ROOT_PASSWORD: rootpass | ||
|
||
mongodb: | ||
image: mongo:3.0.4 | ||
volumes: | ||
- mongo-data:/data/db | ||
ports: | ||
- "27017:27017" | ||
|
||
volumes: | ||
mysql-data: | ||
driver: local | ||
mongo-data: | ||
driver: local |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/usr/bin/env bash | ||
|
||
. docker/bin/envs | ||
|
||
PAYUM_ROOT_DIR=$PAYUM_ROOT_DIR docker-compose -p $COMPOSE_PROJECT_NAME build $PAYUM_EXTRA_ARGS |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/usr/bin/env bash | ||
|
||
. docker/bin/envs | ||
|
||
docker exec -it ${1:-$PAYUM_WEB_CONTAINER} env TERM=xterm /bin/bash |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/usr/bin/env bash | ||
|
||
PAYUM_DEBUG=${PAYUM_DEBUG:-false} | ||
if [ "$PAYUM_DEBUG" = true ] ; then | ||
set -x | ||
set -e | ||
fi | ||
|
||
PAYUM_ROOT_DIR="$( pwd )" | ||
|
||
COMPOSE_PROJECT_NAME=${COMPOSE_PROJECT_NAME:-payum} | ||
|
||
PAYUM_EXTRA_ARGS="$@" | ||
PAYUM_WEB_CONTAINER=$COMPOSE_PROJECT_NAME"_web_1" |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/usr/bin/env bash | ||
|
||
. docker/bin/envs | ||
|
||
PAYUM_EXTRA_ARGS=$(echo "$PAYUM_EXTRA_ARGS" | sed -e "s/[^ ]*ide-phpunit.php/\/usr\/local\/bin\/ide-phpunit\.php/g") | ||
PAYUM_EXTRA_ARGS=$(echo "$PAYUM_EXTRA_ARGS" | sed -e "s/[^ ]*ide-phpinfo.php/\/usr\/local\/bin\/ide-phpinfo.php/g") | ||
|
||
|
||
#fix for --filter /::testShouldImplementMessageProcessorInterface( .*)?$/ | ||
PAYUM_EXTRA_ARGS=$(echo "$PAYUM_EXTRA_ARGS" | sed -e "s/\/\:\:/\"\/\:\:/g") | ||
PAYUM_EXTRA_ARGS=$(echo "$PAYUM_EXTRA_ARGS" | sed -e "s/\?\$\//\?\$\/\"/g") | ||
|
||
IDE_PHPUNIT_ENVS=$(printenv | grep IDE_PHPUNIT | cat) | ||
|
||
docker exec -i "$PAYUM_WEB_CONTAINER" /bin/bash -c "cd $(pwd);$IDE_PHPUNIT_ENVS php $PAYUM_EXTRA_ARGS" |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/usr/bin/env bash | ||
|
||
. docker/bin/envs | ||
|
||
PAYUM_ROOT_DIR=$PAYUM_ROOT_DIR COMPOSE_PROJECT_NAME=$COMPOSE_PROJECT_NAME docker-compose stop $PAYUM_EXTRA_ARGS |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/usr/bin/env bash | ||
|
||
. docker/bin/envs | ||
|
||
PAYUM_ROOT_DIR=$PAYUM_ROOT_DIR COMPOSE_PROJECT_NAME=$COMPOSE_PROJECT_NAME docker-compose up $PAYUM_EXTRA_ARGS |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/usr/bin/env bash | ||
|
||
mkdir -p $PAYUM_ROOT_DIR; | ||
(rm -rf /payum && cd / && ln -s $PAYUM_ROOT_DIR payum) | ||
|
||
/usr/bin/supervisord -n -c /etc/supervisor/supervisord.conf -l /var/log/payum/supervisor.log | ||
|
||
tail --pid $$ -F /payum/app/logs/* & | ||
tail --pid $$ -F /var/log/payum/* & |
Empty file.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
server { | ||
server_name payum.dev; | ||
root /payum/web; | ||
|
||
location / { | ||
# try to serve file directly, fallback to app.php | ||
try_files $uri /app.php$is_args$args; | ||
} | ||
# DEV | ||
# This rule should only be placed on your development environment | ||
# In production, don't include this and don't deploy app_dev.php or config.php | ||
location ~ ^/(app_dev|config)\.php(/|$) { | ||
fastcgi_pass unix:/run/payum-fpm.sock; | ||
fastcgi_split_path_info ^(.+\.php)(/.*)$; | ||
include fastcgi_params; | ||
# When you are using symlinks to link the document root to the | ||
# current version of your application, you should pass the real | ||
# application path instead of the path to the symlink to PHP | ||
# FPM. | ||
# Otherwise, PHP's OPcache may not properly detect changes to | ||
# your PHP files (see https://github.com/zendtech/ZendOptimizerPlus/issues/126 | ||
# for more information). | ||
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name; | ||
fastcgi_param DOCUMENT_ROOT $realpath_root; | ||
} | ||
# PROD | ||
location ~ ^/app\.php(/|$) { | ||
fastcgi_pass unix:/var/run/payum-fpm.sock; | ||
fastcgi_split_path_info ^(.+\.php)(/.*)$; | ||
include fastcgi_params; | ||
# When you are using symlinks to link the document root to the | ||
# current version of your application, you should pass the real | ||
# application path instead of the path to the symlink to PHP | ||
# FPM. | ||
# Otherwise, PHP's OPcache may not properly detect changes to | ||
# your PHP files (see https://github.com/zendtech/ZendOptimizerPlus/issues/126 | ||
# for more information). | ||
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name; | ||
fastcgi_param DOCUMENT_ROOT $realpath_root; | ||
# Prevents URIs that include the front controller. This will 404: | ||
# http://domain.tld/app.php/some-path | ||
# Remove the internal directive to allow URIs like this | ||
internal; | ||
} | ||
|
||
# return 404 for all other php files not matching the front controller | ||
# this prevents access to other php files you don't want to be accessible. | ||
location ~ \.php$ { | ||
return 404; | ||
} | ||
|
||
error_log /var/log/payum/nginx_error.log; | ||
access_log /var/log/payum/nginx_access.log; | ||
} |
Oops, something went wrong.