diff --git a/CHANGELOG.md b/CHANGELOG.md index af53efa5..db366a3f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## v2.3.0 + +### Changed + +- Basic sources URIs +- (docker) Now docker image based on [PHPPM][phppm] + +[phppm]:https://github.com/php-pm/php-pm + ## v2.2.1 ### Added diff --git a/Dockerfile b/Dockerfile index 18e50500..cd5356ab 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,39 +1,30 @@ -FROM php:7.2-alpine +FROM phppm/nginx:latest LABEL Description="Mikrotik hosts parser application container" -ENV COMPOSER_HOME /usr/local/share/composer -ENV COMPOSER_ALLOW_SUPERUSER 1 -ENV PATH "$COMPOSER_HOME:$COMPOSER_HOME/vendor/bin:$PATH" +COPY . /app/src + +WORKDIR /app/src -# Install basic deps RUN \ - docker-php-ext-install opcache \ + echo -e "\n\ +alias ls='ls --color=auto';\n\ +export PS1='\[\e[1;31m\]\$(echo \"[\"\${?/0/}\"]\" | sed \"s/\\[\\]//\")\$(echo \"\[\e[32m\][hosts-parser] \ +\[\e[37m\]\")\u@\h: \[\e[00m\]\w \\$ ';\n\n" >> /root/.bashrc \ && php --version \ - && mkdir -pv $COMPOSER_HOME && chmod -R g+w $COMPOSER_HOME \ + && export COMPOSER_HOME="/usr/local/share" \ + && export COMPOSER_ALLOW_SUPERUSER="1" \ + && export PATH="$COMPOSER_HOME:$COMPOSER_HOME/vendor/bin:$PATH" \ && php -r "copy('https://getcomposer.org/installer', '/tmp/composer-setup.php');" \ && php -r "if(hash_file('SHA384','/tmp/composer-setup.php')==='544e09ee996cdf60ece3804abc52599c22b1f40f4323403c'.\ '44d44fdfdd586475ca9813a858088ffbc1f233e9b180f061'){echo 'Verified';}else{unlink('/tmp/composer-setup.php');}" \ && php /tmp/composer-setup.php --filename=composer --install-dir=$COMPOSER_HOME \ + && rm -Rf /tmp/* \ && $COMPOSER_HOME/composer --no-interaction global require 'hirak/prestissimo' \ - && $COMPOSER_HOME/composer --version && $COMPOSER_HOME/composer global info \ - && rm -rf /tmp/composer-setup* \ - && mkdir -pv /app/src - -WORKDIR /app/src - -# Copy application sources and configs -COPY . /app/src -COPY ./docker-entrypoint.sh /docker-entrypoint.sh - -# Make composer install and configure other applications -RUN \ - cd /app/src \ && composer install --no-interaction --no-suggest --no-dev \ && composer clear-cache \ - && chmod +x /docker-entrypoint.sh \ - && php ./artisan + && composer dump-autoload \ + && php ./artisan cache:clear + +VOLUME ["/app/src"] -STOPSIGNAL SIGTERM -EXPOSE 80 -ENTRYPOINT ["/docker-entrypoint.sh"] -CMD ["php", "-S", "0.0.0.0:80", "-t", "./public"] +CMD ["--bootstrap=laravel", "--app-env=prod", "--workers=8", "--static-directory=public/"] diff --git a/README.md b/README.md index 389aca3d..a4b50bdf 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ [![Version][badge_packagist_version]][link_packagist] [![Version][badge_php_version]][link_packagist] +[![PPM Compatible][badge_ppm]][link_ppm] [![Build Status][badge_build_status]][link_build_status] [![Coverage][badge_coverage]][link_coverage] [![Code quality][badge_code_quality]][link_coverage] @@ -68,6 +69,7 @@ This is open-sourced software licensed under the [MIT License][link_license]. [badge_packagist_version]:https://img.shields.io/packagist/v/tarampampam/mikrotik-hosts-parser.svg?style=flat-square&maxAge=180 [badge_php_version]:https://img.shields.io/packagist/php-v/tarampampam/mikrotik-hosts-parser.svg?style=flat-square&longCache=true +[badge_ppm]:https://raw.githubusercontent.com/php-pm/ppm-badge/master/ppm-badge.png [badge_build_status]:https://img.shields.io/scrutinizer/build/g/tarampampam/mikrotik-hosts-parser.svg?style=flat-square&maxAge=180&logo=scrutinizer [badge_code_quality]:https://img.shields.io/scrutinizer/g/tarampampam/mikrotik-hosts-parser.svg?style=flat-square&maxAge=180 [badge_coverage]:https://img.shields.io/scrutinizer/coverage/g/tarampampam/mikrotik-hosts-parser.svg?style=flat-square&maxAge=180 @@ -82,6 +84,7 @@ This is open-sourced software licensed under the [MIT License][link_license]. [badge_docker_size]:https://images.microbadger.com/badges/image/tarampampam/mikrotik-hosts-parser:latest.svg?style=flat-square [link_releases]:https://github.com/tarampampam/mikrotik-hosts-parser/releases [link_packagist]:https://packagist.org/packages/tarampampam/mikrotik-hosts-parser +[link_ppm]:https://github.com/php-pm/php-pm [link_build_status]:https://scrutinizer-ci.com/g/tarampampam/mikrotik-hosts-parser/build-status/master [link_coverage]:https://scrutinizer-ci.com/g/tarampampam/mikrotik-hosts-parser/?branch=master [link_changes_log]:https://github.com/tarampampam/mikrotik-hosts-parser/blob/master/CHANGELOG.md diff --git a/config/app.php b/config/app.php index bec07005..f0404070 100644 --- a/config/app.php +++ b/config/app.php @@ -3,7 +3,7 @@ return [ // Версия - 'version' => '2.2.0', + 'version' => '2.3.0', /* |-------------------------------------------------------------------------- diff --git a/docker-compose.yml b/docker-compose.yml index 30d5e0fd..9762c905 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -4,15 +4,13 @@ services: application: container_name: mikrotik-parser-app restart: on-failure - build: - context: . - dockerfile: Dockerfile + build: . environment: APP_KEY: 'SOME_RANDOM_STRING_HERE' AUTHOR_EMAIL: 'tarampampam@users.noreply.github.com' - REDIRECT_IP: '127.0.0.2' + #REDIRECT_IP: '127.0.0.1' EXCLUDED_HOSTS: 'localhost' - SCRIPT_AD_ENTRIES_COMMENT: 'ADBlock' + #SCRIPT_AD_ENTRIES_COMMENT: 'ADBlock' LIMIT_USER_SOURCES: 8 LIMIT_RESULT_ENTRIES: 0 LIMIT_SOURCE_CACHE_LIFETIME: 7200 @@ -24,4 +22,4 @@ services: #FORCE_HTTPS: 'true' #APP_URL: 'http://mydomain3.com' ports: - - "8000:80" + - '8000:80' diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh deleted file mode 100755 index 0ac4f95c..00000000 --- a/docker-entrypoint.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env sh -set -e - -PHP_BIN=$(which php); -COMPOSER_BIN=$(which composer); -APP_DIR="${PWD:-/app/src}"; - -cd "$APP_DIR"; - -echo '[info] Environment variables:'; -printenv; -echo; - -"$COMPOSER_BIN" dump-autoload; -"$PHP_BIN" ./artisan cache:clear; - -exec "$@"