From 93c803128e65da2d879b1e5072212816754fe12f Mon Sep 17 00:00:00 2001 From: Paramtamtam Date: Thu, 24 Jan 2019 18:23:39 +0500 Subject: [PATCH] Composer installation in dockerfile fixed --- .editorconfig | 26 +++++++++++++++++--------- CHANGELOG.md | 13 +++++++++++++ Dockerfile | 36 ++++++++++++++++-------------------- 3 files changed, 46 insertions(+), 29 deletions(-) diff --git a/.editorconfig b/.editorconfig index cf0eb6e3..9cbb16ef 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,10 +1,18 @@ +root = true + [*] -charset=utf-8 -end_of_line=lf -insert_final_newline=false -indent_style=space -indent_size=4 - -[{*.yml,*.yaml}] -indent_style=space -indent_size=2 +charset = utf-8 +end_of_line = lf +insert_final_newline = true +indent_style = space +indent_size = 4 +trim_trailing_whitespace = true + +[*.{md,json}] +trim_trailing_whitespace = false + +[*.{yml,yaml,sh,conf}] +indent_size = 2 + +[Makefile] +indent_style = tab diff --git a/CHANGELOG.md b/CHANGELOG.md index db366a3f..3f3b0cbf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,15 @@ # Changelog +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog][keepachangelog] and this project adheres to [Semantic Versioning][semver]. + +## v2.3.1 + +### Fixed + +- Composer installation in dockerfile + ## v2.3.0 ### Changed @@ -33,3 +43,6 @@ - `WindowsSpyBlocker` hosts file URI [#10] [#10]: https://github.com/tarampampam/mikrotik-hosts-parser/issues/10 + +[keepachangelog]:https://keepachangelog.com/en/1.0.0/ +[semver]:https://semver.org/spec/v2.0.0.html diff --git a/Dockerfile b/Dockerfile index cd5356ab..f8841aa0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,30 +1,26 @@ +FROM composer:1.8.0 AS composer + FROM phppm/nginx:latest LABEL Description="Mikrotik hosts parser application container" +ENV COMPOSER_ALLOW_SUPERUSER="1" \ + COMPOSER_HOME="/tmp/composer" \ + PS1='\[\033[1;32m\]🐳 \[\033[1;36m\][\u@\h] \[\033[1;34m\]\w\[\033[0;35m\] \[\033[1;36m\]# \[\033[0m\]' + +COPY --from=composer /usr/bin/composer /usr/bin/composer COPY . /app/src WORKDIR /app/src -RUN \ - 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 \ - && 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 install --no-interaction --no-suggest --no-dev \ - && composer clear-cache \ - && composer dump-autoload \ - && php ./artisan cache:clear +RUN set -xe \ + && php --version \ + && rm -Rf /tmp/* \ + && composer global require 'hirak/prestissimo' --no-interaction --no-suggest --prefer-dist \ + && composer install --no-dev --no-interaction --no-ansi --no-suggest --prefer-dist \ + && composer clear-cache \ + && composer dump-autoload \ + && php ./artisan cache:clear VOLUME ["/app/src"] -CMD ["--bootstrap=laravel", "--app-env=prod", "--workers=8", "--static-directory=public/"] +CMD ["--bootstrap=laravel", "--app-env=prod", "--workers=4", "--static-directory=public/"]