From 2fa0096cf956bee44163efd6ed5ac3aec2e3f918 Mon Sep 17 00:00:00 2001 From: atnartur Date: Sat, 7 Jan 2017 01:17:11 +0300 Subject: [PATCH 1/6] + Docker dev environment --- docker-compose.yml | 53 ++++++++++ docker/Dockerfile | 6 ++ docker/config.ini | 36 +++++++ docker/mysql.cnf | 2 + docker/nginx/fastcgi_params | 25 +++++ docker/nginx/mime.types | 84 ++++++++++++++++ docker/nginx/nginx.conf | 75 ++++++++++++++ vendor/autoload.php | 2 +- vendor/composer/autoload_real.php | 8 +- wait-for-it.sh | 161 ++++++++++++++++++++++++++++++ 10 files changed, 447 insertions(+), 5 deletions(-) create mode 100644 docker-compose.yml create mode 100644 docker/Dockerfile create mode 100644 docker/config.ini create mode 100644 docker/mysql.cnf create mode 100644 docker/nginx/fastcgi_params create mode 100644 docker/nginx/mime.types create mode 100644 docker/nginx/nginx.conf create mode 100755 wait-for-it.sh diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..e4cbbec --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,53 @@ +version: '2' + +services: + web: + image: nginx:latest + ports: + - 80:80 + volumes_from: + - data + volumes: + - ./docker/nginx/:/etc/nginx/:ro + depends_on: + - php + + php: + image: atnartur/php:5.6-fpm-phalcon2.0.13 + working_dir: /srv/www/app + command: > + sh -c "php composer.phar update && + ./wait-for-it.sh db:3306 -t 30 && + chmod 777 public/content && + php-fpm -RF" + depends_on: + - db + volumes_from: + - data + volumes: + - system-tmp:/tmp + db: + image: percona:latest + ports: + - 3306:3306 + environment: + MYSQL_ROOT_PASSWORD: rootpass + MYSQL_DATABASE: banners + MYSQL_USER: banners + MYSQL_PASSWORD: bannerspass + volumes: + - ./docker/mysql.cnf:/etc/mysql/conf.d/extra.cnf + - db:/var/lib/mysql + + data: + build: + context: ./ + dockerfile: ./docker/Dockerfile + volumes: + - ./:/srv/www/app + +volumes: + system-tmp: + driver: local + db: + driver: local \ No newline at end of file diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000..a1dc2b2 --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,6 @@ +FROM alpine:3.3 +COPY ./docker/nginx /etc/nginx +COPY . /srv/www/app +WORKDIR /srv/www/app +RUN cp ./docker/config.ini /srv/www/app/app/config/config.ini +CMD /bin/true diff --git a/docker/config.ini b/docker/config.ini new file mode 100644 index 0000000..d005e16 --- /dev/null +++ b/docker/config.ini @@ -0,0 +1,36 @@ +[app] +timezone = "Europe/Moscow" +locale = "ru_RU.utf-8" +controllersDir = "/controllers/" +modelsDir = "/models/" +viewsDir = "/views/" +libraryDir = "/library/" +cacheDir = "/cache/" +tasksDir = "/tasks/" +log = "/logs/log" +environment = "production" +;environment = "development" + +[database] +host = "db" +username = "banners" +password = "bannerspass" +dbname = "banners" +charset = "utf8" + +[auth] +hash_method = "sha256" +hash_key = "secret_key" +lifetime = 1209600 +session_key = "auth_user" +session_role = "auth_user_role" + +[session] +options[lifetime] = 1209600 + +[crypt] +key = "need_a_key_16sym" + +[banners] +flashPath = "content/flash/" +imagePath = "content/images/" \ No newline at end of file diff --git a/docker/mysql.cnf b/docker/mysql.cnf new file mode 100644 index 0000000..ae0a049 --- /dev/null +++ b/docker/mysql.cnf @@ -0,0 +1,2 @@ +[mysqld] +sql-mode="NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION" \ No newline at end of file diff --git a/docker/nginx/fastcgi_params b/docker/nginx/fastcgi_params new file mode 100644 index 0000000..4ee14e9 --- /dev/null +++ b/docker/nginx/fastcgi_params @@ -0,0 +1,25 @@ +fastcgi_param QUERY_STRING $query_string; +fastcgi_param REQUEST_METHOD $request_method; +fastcgi_param CONTENT_TYPE $content_type; +fastcgi_param CONTENT_LENGTH $content_length; + +fastcgi_param SCRIPT_FILENAME $request_filename; +fastcgi_param SCRIPT_NAME $fastcgi_script_name; +fastcgi_param REQUEST_URI $request_uri; +fastcgi_param DOCUMENT_URI $document_uri; +fastcgi_param DOCUMENT_ROOT $document_root; +fastcgi_param SERVER_PROTOCOL $server_protocol; + +fastcgi_param GATEWAY_INTERFACE CGI/1.1; +fastcgi_param SERVER_SOFTWARE nginx/$nginx_version; + +fastcgi_param REMOTE_ADDR $remote_addr; +fastcgi_param REMOTE_PORT $remote_port; +fastcgi_param SERVER_ADDR $server_addr; +fastcgi_param SERVER_PORT $server_port; +fastcgi_param SERVER_NAME $server_name; + +fastcgi_param HTTPS $https if_not_empty; + +# PHP only, required if PHP was built with --enable-force-cgi-redirect +fastcgi_param REDIRECT_STATUS 200; diff --git a/docker/nginx/mime.types b/docker/nginx/mime.types new file mode 100644 index 0000000..2635eff --- /dev/null +++ b/docker/nginx/mime.types @@ -0,0 +1,84 @@ +types { + text/html html htm shtml; + text/css css; + text/xml xml rss; + image/gif gif; + image/jpeg jpeg jpg; + application/x-javascript js; + application/atom+xml atom; + + text/mathml mml; + text/plain txt; + text/vnd.sun.j2me.app-descriptor jad; + text/vnd.wap.wml wml; + text/x-component htc; + + image/png png; + image/tiff tif tiff; + image/vnd.wap.wbmp wbmp; + image/x-icon ico; + image/x-jng jng; + image/x-ms-bmp bmp; + image/svg+xml svg svgz; + + application/java-archive jar war ear; + application/json json; + application/mac-binhex40 hqx; + application/msword doc; + application/pdf pdf; + application/postscript ps eps ai; + application/rtf rtf; + application/vnd.ms-excel xls; + application/vnd.ms-powerpoint ppt; + application/vnd.wap.wmlc wmlc; + application/vnd.google-earth.kml+xml kml; + application/vnd.google-earth.kmz kmz; + application/x-7z-compressed 7z; + application/x-cocoa cco; + application/x-java-archive-diff jardiff; + application/x-java-jnlp-file jnlp; + application/x-makeself run; + application/x-perl pl pm; + application/x-pilot prc pdb; + application/x-rar-compressed rar; + application/x-redhat-package-manager rpm; + application/x-sea sea; + application/x-shockwave-flash swf; + application/x-stuffit sit; + application/x-tcl tcl tk; + application/x-x509-ca-cert der pem crt; + application/x-xpinstall xpi; + application/xhtml+xml xhtml; + application/zip zip; + + application/octet-stream bin exe dll; + application/octet-stream deb; + application/octet-stream dmg; + #application/octet-stream eot; + application/octet-stream iso img; + application/octet-stream msi msp msm; + application/ogg ogx; + + audio/midi mid midi kar; + audio/mpeg mpga mpega mp2 mp3 m4a; + audio/ogg oga ogg spx; + audio/x-realaudio ra; + audio/webm weba; + + video/3gpp 3gpp 3gp; + video/mp4 mp4; + video/mpeg mpeg mpg mpe; + video/ogg ogv; + video/quicktime mov; + video/webm webm; + video/x-flv flv; + video/x-mng mng; + video/x-ms-asf asx asf; + video/x-ms-wmv wmv; + video/x-msvideo avi; + + application/x-font-ttf ttf; + application/font-otf otf; + application/octet-stream eot; + application/font-woff woff; +} diff --git a/docker/nginx/nginx.conf b/docker/nginx/nginx.conf new file mode 100644 index 0000000..b177583 --- /dev/null +++ b/docker/nginx/nginx.conf @@ -0,0 +1,75 @@ +user root; +worker_processes 1; + +error_log /var/log/nginx/error.log warn; +pid /var/run/nginx.pid; + +events { + worker_connections 1024; +} + +http { + include mime.types; + default_type application/octet-stream; + + #set_real_ip_from 172.0.0.0/8; + real_ip_header X-Real-IP; + + log_format main '$remote_addr - $remote_user [$time_local] "$request" ' + '$status $body_bytes_sent "$http_referer" ' + '"$http_user_agent" "$http_x_forwarded_for"'; + + access_log /var/log/nginx/access.log main; + + sendfile on; + tcp_nopush on; + + keepalive_timeout 65; + + # gzip on; + + server { + listen 80; + + charset UTF-8; + + index index.php index.html index.htm; + set $root_path '/srv/www/app/public'; + root $root_path; + + access_log /dev/stdout; + error_log stderr error; + + location / { + try_files $uri /index.php?$args; + + if ($request_uri ~ "/+[^\.]+$"){ + rewrite ^([^.]*[^/])$ $1/ permanent; + } + + if (!-e $request_filename){ + rewrite ^(.*)$ /index.php?$args; + } + } + + location /api/{ + try_files $uri /api/index.php?$args; + } + + location ~ \.php { + fastcgi_pass php:9000; + fastcgi_index /index.php; + include fastcgi_params; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + fastcgi_param REMOTE_ADDR $remote_addr; + } + + location ~* ^/(css|img|js|flv|swf|download)/(.+)$ { + root $root_path; + } + + location ~ /\.ht { + deny all; + } + } +} diff --git a/vendor/autoload.php b/vendor/autoload.php index 9abb119..5d0940a 100644 --- a/vendor/autoload.php +++ b/vendor/autoload.php @@ -4,4 +4,4 @@ require_once __DIR__ . '/composer' . '/autoload_real.php'; -return ComposerAutoloaderInit7fb95d24f861f7031367dfede4436d72::getLoader(); +return ComposerAutoloaderInitdcb12aa5b760f329d231d9eee8db295f::getLoader(); diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php index 1df8488..0100dd4 100644 --- a/vendor/composer/autoload_real.php +++ b/vendor/composer/autoload_real.php @@ -2,7 +2,7 @@ // autoload_real.php @generated by Composer -class ComposerAutoloaderInit7fb95d24f861f7031367dfede4436d72 +class ComposerAutoloaderInitdcb12aa5b760f329d231d9eee8db295f { private static $loader; @@ -19,9 +19,9 @@ public static function getLoader() return self::$loader; } - spl_autoload_register(array('ComposerAutoloaderInit7fb95d24f861f7031367dfede4436d72', 'loadClassLoader'), true, true); + spl_autoload_register(array('ComposerAutoloaderInitdcb12aa5b760f329d231d9eee8db295f', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(); - spl_autoload_unregister(array('ComposerAutoloaderInit7fb95d24f861f7031367dfede4436d72', 'loadClassLoader')); + spl_autoload_unregister(array('ComposerAutoloaderInitdcb12aa5b760f329d231d9eee8db295f', 'loadClassLoader')); $map = require __DIR__ . '/autoload_namespaces.php'; foreach ($map as $namespace => $path) { @@ -44,7 +44,7 @@ public static function getLoader() } } -function composerRequire7fb95d24f861f7031367dfede4436d72($file) +function composerRequiredcb12aa5b760f329d231d9eee8db295f($file) { require $file; } diff --git a/wait-for-it.sh b/wait-for-it.sh new file mode 100755 index 0000000..2af99e0 --- /dev/null +++ b/wait-for-it.sh @@ -0,0 +1,161 @@ +#!/usr/bin/env bash +# Use this script to test if a given TCP host/port are available + +cmdname=$(basename $0) + +echoerr() { if [[ $QUIET -ne 1 ]]; then echo "$@" 1>&2; fi } + +usage() +{ + cat << USAGE >&2 +Usage: + $cmdname host:port [-s] [-t timeout] [-- command args] + -h HOST | --host=HOST Host or IP under test + -p PORT | --port=PORT TCP port under test + Alternatively, you specify the host and port as host:port + -s | --strict Only execute subcommand if the test succeeds + -q | --quiet Don't output any status messages + -t TIMEOUT | --timeout=TIMEOUT + Timeout in seconds, zero for no timeout + -- COMMAND ARGS Execute command with args after the test finishes +USAGE + exit 1 +} + +wait_for() +{ + if [[ $TIMEOUT -gt 0 ]]; then + echoerr "$cmdname: waiting $TIMEOUT seconds for $HOST:$PORT" + else + echoerr "$cmdname: waiting for $HOST:$PORT without a timeout" + fi + start_ts=$(date +%s) + while : + do + (echo > /dev/tcp/$HOST/$PORT) >/dev/null 2>&1 + result=$? + if [[ $result -eq 0 ]]; then + end_ts=$(date +%s) + echoerr "$cmdname: $HOST:$PORT is available after $((end_ts - start_ts)) seconds" + break + fi + sleep 1 + done + return $result +} + +wait_for_wrapper() +{ + # In order to support SIGINT during timeout: http://unix.stackexchange.com/a/57692 + if [[ $QUIET -eq 1 ]]; then + timeout $TIMEOUT $0 --quiet --child --host=$HOST --port=$PORT --timeout=$TIMEOUT & + else + timeout $TIMEOUT $0 --child --host=$HOST --port=$PORT --timeout=$TIMEOUT & + fi + PID=$! + trap "kill -INT -$PID" INT + wait $PID + RESULT=$? + if [[ $RESULT -ne 0 ]]; then + echoerr "$cmdname: timeout occurred after waiting $TIMEOUT seconds for $HOST:$PORT" + fi + return $RESULT +} + +# process arguments +while [[ $# -gt 0 ]] +do + case "$1" in + *:* ) + hostport=(${1//:/ }) + HOST=${hostport[0]} + PORT=${hostport[1]} + shift 1 + ;; + --child) + CHILD=1 + shift 1 + ;; + -q | --quiet) + QUIET=1 + shift 1 + ;; + -s | --strict) + STRICT=1 + shift 1 + ;; + -h) + HOST="$2" + if [[ $HOST == "" ]]; then break; fi + shift 2 + ;; + --host=*) + HOST="${1#*=}" + shift 1 + ;; + -p) + PORT="$2" + if [[ $PORT == "" ]]; then break; fi + shift 2 + ;; + --port=*) + PORT="${1#*=}" + shift 1 + ;; + -t) + TIMEOUT="$2" + if [[ $TIMEOUT == "" ]]; then break; fi + shift 2 + ;; + --timeout=*) + TIMEOUT="${1#*=}" + shift 1 + ;; + --) + shift + CLI="$@" + break + ;; + --help) + usage + ;; + *) + echoerr "Unknown argument: $1" + usage + ;; + esac +done + +if [[ "$HOST" == "" || "$PORT" == "" ]]; then + echoerr "Error: you need to provide a host and port to test." + usage +fi + +TIMEOUT=${TIMEOUT:-15} +STRICT=${STRICT:-0} +CHILD=${CHILD:-0} +QUIET=${QUIET:-0} + +if [[ $CHILD -gt 0 ]]; then + wait_for + RESULT=$? + exit $RESULT +else + if [[ $TIMEOUT -gt 0 ]]; then + wait_for_wrapper + RESULT=$? + else + wait_for + RESULT=$? + fi +fi + +if [[ $CLI != "" ]]; then + if [[ $RESULT -ne 0 && $STRICT -eq 1 ]]; then + echoerr "$cmdname: strict mode, refusing to execute subprocess" + exit $RESULT + fi + exec $CLI +else + exit $RESULT +fi \ No newline at end of file From cab72d9dfac57de66767707ed96cec8b02e48fbe Mon Sep 17 00:00:00 2001 From: atnartur Date: Sat, 7 Jan 2017 01:24:02 +0300 Subject: [PATCH 2/6] + Dockerignore + phinx --- .dockerignore | 5 +++++ .gitignore | 3 ++- composer.json | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..3a59472 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,5 @@ +.git +vendor +public/content +docker-compose.* +docker \ No newline at end of file diff --git a/.gitignore b/.gitignore index cf074ca..e6b83ce 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ /.idea/ /app/config/config.ini -vendor \ No newline at end of file +vendor +composer.lock \ No newline at end of file diff --git a/composer.json b/composer.json index df8dd9c..d27c5e3 100644 --- a/composer.json +++ b/composer.json @@ -1,4 +1,5 @@ { "require": { + "robmorgan/phinx": "0.6.*" } } From 9e9f068ee3df742877ba9c537b09062bf8d07ebe Mon Sep 17 00:00:00 2001 From: atnartur Date: Sat, 7 Jan 2017 01:27:51 +0300 Subject: [PATCH 3/6] =?UTF-8?q?+=20=D0=9C=D0=B8=D0=B3=D1=80=D0=B0=D1=86?= =?UTF-8?q?=D0=B8=D1=8F=20=D0=B4=D0=BB=D1=8F=20=D0=BF=D1=80=D0=B8=D0=BC?= =?UTF-8?q?=D0=B5=D0=BD=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=BD=D0=B0=D1=87=D0=B0?= =?UTF-8?q?=D0=BB=D1=8C=D0=BD=D0=BE=D0=B3=D0=BE=20=D0=B4=D0=B0=D0=BC=D0=BF?= =?UTF-8?q?=D0=B0=20=D0=B1=D0=B0=D0=B7=D1=8B=20=D0=B4=D0=B0=D0=BD=D0=BD?= =?UTF-8?q?=D1=8B=D1=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20170106222446_exec_sql_dump.php | 33 +++++++++++++++ docker-compose.yml | 1 + phinx.yml | 42 +++++++++++++++++++ 3 files changed, 76 insertions(+) create mode 100644 db/migrations/20170106222446_exec_sql_dump.php create mode 100644 phinx.yml diff --git a/db/migrations/20170106222446_exec_sql_dump.php b/db/migrations/20170106222446_exec_sql_dump.php new file mode 100644 index 0000000..9b91d29 --- /dev/null +++ b/db/migrations/20170106222446_exec_sql_dump.php @@ -0,0 +1,33 @@ +execute($file); + } +} diff --git a/docker-compose.yml b/docker-compose.yml index e4cbbec..9fb2a02 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -18,6 +18,7 @@ services: command: > sh -c "php composer.phar update && ./wait-for-it.sh db:3306 -t 30 && + vendor/bin/phinx migrate -e docker && chmod 777 public/content && php-fpm -RF" depends_on: diff --git a/phinx.yml b/phinx.yml new file mode 100644 index 0000000..e480408 --- /dev/null +++ b/phinx.yml @@ -0,0 +1,42 @@ +paths: + migrations: %%PHINX_CONFIG_DIR%%/db/migrations + seeds: %%PHINX_CONFIG_DIR%%/db/seeds + +environments: + default_migration_table: phinxlog + default_database: development + production: + adapter: mysql + host: localhost + name: production_db + user: root + pass: '' + port: 3306 + charset: utf8 + + development: + adapter: mysql + host: localhost + name: development_db + user: root + pass: '' + port: 3306 + charset: utf8 + + testing: + adapter: mysql + host: localhost + name: testing_db + user: root + pass: '' + port: 3306 + charset: utf8 + + docker: + adapter: mysql + host: db + name: banners + user: banners + pass: bannerspass + port: 3306 + charset: utf8 \ No newline at end of file From 746c308dc06252292345ad37942ca1f439c89382 Mon Sep 17 00:00:00 2001 From: atnartur Date: Sat, 7 Jan 2017 01:40:06 +0300 Subject: [PATCH 4/6] ! nginx config --- docker/nginx/nginx.conf | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/docker/nginx/nginx.conf b/docker/nginx/nginx.conf index b177583..f7eecf6 100644 --- a/docker/nginx/nginx.conf +++ b/docker/nginx/nginx.conf @@ -40,20 +40,11 @@ http { access_log /dev/stdout; error_log stderr error; - location / { - try_files $uri /index.php?$args; + try_files $uri $uri/ @rewrite; - if ($request_uri ~ "/+[^\.]+$"){ - rewrite ^([^.]*[^/])$ $1/ permanent; - } - - if (!-e $request_filename){ - rewrite ^(.*)$ /index.php?$args; - } - } - - location /api/{ - try_files $uri /api/index.php?$args; + location @rewrite { + rewrite ^/(.*)/$ /$1 permanent; + rewrite ^/(.*)$ /index.php?_url=/$1; } location ~ \.php { @@ -62,6 +53,7 @@ http { include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param REMOTE_ADDR $remote_addr; + } location ~* ^/(css|img|js|flv|swf|download)/(.+)$ { From 91d6936b70e3b76d156f3fb10bbe630c7c94221f Mon Sep 17 00:00:00 2001 From: atnartur Date: Sat, 7 Jan 2017 01:58:39 +0300 Subject: [PATCH 5/6] =?UTF-8?q?=3D=20=D1=83=D1=81=D1=82=D0=B0=D0=BD=D0=BE?= =?UTF-8?q?=D0=B2=D0=BA=D0=B0=20composer=20=D0=BF=D0=B0=D0=BA=D0=B5=D1=82?= =?UTF-8?q?=D0=BE=D0=B2=20=D0=BF=D0=B5=D1=80=D0=B5=D0=BD=D0=B5=D1=81=D0=B5?= =?UTF-8?q?=D0=BD=D0=B0=20=D0=B2=20=D1=81=D0=B1=D0=BE=D1=80=D0=BA=D1=83=20?= =?UTF-8?q?=D0=BE=D0=B1=D1=80=D0=B0=D0=B7=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .dockerignore | 3 +-- docker-compose.prod.yml | 55 +++++++++++++++++++++++++++++++++++++++++ docker/Dockerfile | 6 ++++- 3 files changed, 61 insertions(+), 3 deletions(-) create mode 100644 docker-compose.prod.yml diff --git a/.dockerignore b/.dockerignore index 3a59472..6a9828e 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,5 +1,4 @@ .git vendor public/content -docker-compose.* -docker \ No newline at end of file +docker-compose.* \ No newline at end of file diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml new file mode 100644 index 0000000..f43ed25 --- /dev/null +++ b/docker-compose.prod.yml @@ -0,0 +1,55 @@ +version: '2' + +services: + web: + image: nginx:latest + ports: + - 80:80 + volumes_from: + - data + depends_on: + - php + + php: + image: atnartur/php:5.6-fpm-phalcon2.0.13 + working_dir: /srv/www/app + command: > + sh -c "./wait-for-it.sh db:3306 -t 30 && + vendor/bin/phinx migrate -e docker && + chmod 777 public/content && + php-fpm -RF" + depends_on: + - db + volumes_from: + - data + volumes: + - files:/srv/www/app/public/content + - system-tmp:/tmp + db: + image: percona:latest + ports: + - 3306:3306 + environment: + MYSQL_ROOT_PASSWORD: rootpass + MYSQL_DATABASE: banners + MYSQL_USER: banners + MYSQL_PASSWORD: bannerspass + volumes: + - ./docker/mysql.cnf:/etc/mysql/conf.d/extra.cnf + - db:/var/lib/mysql + + data: + build: + context: ./ + dockerfile: ./docker/Dockerfile + volumes: + - /srv/www/app + - /etc/nginx + +volumes: + system-tmp: + driver: local + db: + driver: local + files: + driver: local \ No newline at end of file diff --git a/docker/Dockerfile b/docker/Dockerfile index a1dc2b2..e6f9726 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -2,5 +2,9 @@ FROM alpine:3.3 COPY ./docker/nginx /etc/nginx COPY . /srv/www/app WORKDIR /srv/www/app -RUN cp ./docker/config.ini /srv/www/app/app/config/config.ini +RUN cp ./docker/config.ini /srv/www/app/app/config/config.ini && \ + apk update && \ + apk add --no-cache git php php-phar php-json php-ctype php-openssl && \ + php composer.phar install && \ + apk del git php php-phar php-json php-ctype php-openssl CMD /bin/true From 318d96670d1b0c44b08490268b02e226ded63b66 Mon Sep 17 00:00:00 2001 From: atnartur Date: Sat, 7 Jan 2017 02:05:16 +0300 Subject: [PATCH 6/6] + docker docs in readme --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 6ac6410..434cdb2 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,11 @@ SimpleBannerRotator — это предельно минимизирован E-mail: test@test.ru Пароль: 4444 +## Запуск в Docker +- `docker-compose build` - сборка образа +- `docker-copmose up` - запуск версии для разработки +- `docker-compose -f docker-compose.prod.yml up` - запуск production версии + ## Использование 1. В шапку сайта, на котором требуется транслировать баннеры, нужно вставить основной скрипт баннеро-ротатора: