From f62188967c817d01cb6443bb83aea48731c89a38 Mon Sep 17 00:00:00 2001 From: Arthur Moore Date: Thu, 10 Jan 2019 01:28:34 -0500 Subject: [PATCH] HOTFIX: Fix the Docker build --- Dockerfile | 58 ++++++++++++++++---- config.ini | 2 +- docker/epcc/Dockerfile | 6 --- docker/epcc/apache_host.conf | 6 --- docker/epcc/epcc.ini | 96 --------------------------------- docker/epcc/epcc_standalone.ini | 96 --------------------------------- docker/epcc/php.ini | 2 - standalone.env | 17 ++++++ 8 files changed, 66 insertions(+), 217 deletions(-) delete mode 100644 docker/epcc/Dockerfile delete mode 100644 docker/epcc/apache_host.conf delete mode 100644 docker/epcc/epcc.ini delete mode 100644 docker/epcc/epcc_standalone.ini delete mode 100644 docker/epcc/php.ini create mode 100644 standalone.env diff --git a/Dockerfile b/Dockerfile index d0e64ca6..cc156100 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,16 +4,54 @@ FROM php:7.2-apache EXPOSE 80 -RUN a2enmod rewrite -RUN apt update && apt install -y sqlite3 +HEALTHCHECK --interval=5m --timeout=3s \ + CMD curl -f http://localhost/ || exit 1 -COPY docker/epcc/php.ini /usr/local/etc/php/ -COPY docker/epcc/apache_host.conf /etc/apache2/sites-available/000-default.conf -COPY . /var/www/html/ -COPY docker/epcc/epcc_standalone.ini /var/www/html/config.ini +#Enable mod rewrite (required for Laravel), and setup apache for Laravel +RUN a2enmod rewrite && \ + sed -i -e "s/html/html\/public/g" /etc/apache2/sites-enabled/000-default.conf && \ + sed -i -e '/DocumentRoot/a\\n\nAllowOverride All\n<\/Directory>' /etc/apache2/sites-enabled/000-default.conf -#Database prep -RUN mkdir /db/ && \ - touch /db/FullDatabase.sqlite && \ +#Install Mysql PDO extension +#RUN docker-php-ext-install pdo_mysql + +#Install sqlite, unzip (required for composer), and gnupg (needed for node installer) +RUN apt update && apt install -y sqlite3 unzip gnupg + +#Install Composer +RUN curl --silent https://raw.githubusercontent.com/composer/getcomposer.org/d3e09029468023aa4e9dcd165e9b6f43df0a9999/web/installer | php -- --install-dir=/usr/bin/ --filename=composer --quiet + +#Install Node +RUN curl -sL https://raw.githubusercontent.com/nodesource/distributions/0a7ddca803e0f8a4908bbd8142ba863aca2e1274/deb/setup_10.x | bash - && \ + apt install -y nodejs + +#The timezone must be set or else the pdf exporter, and anything else that uses date functions, will fail. +RUN echo '\ndate.timezone = "UTC"' >> /usr/local/etc/php/php.ini + +######### +#Everything after this changes somewhat frequently +######### + +#So the RUN commands are done in the proper context +USER www-data:www-data + +#Actual App +COPY --chown=www-data:www-data . /var/www/html/ + +#SQLite Database prep +ENV DB_DATABASE /var/www/html/database/database.sqlite +RUN rm $DB_DATABASE; touch $DB_DATABASE && \ sed --in-place 's/\\n/ /g' /var/www/html/database/database.sql && \ - sqlite3 --init /var/www/html/database/database.sql /db/database.sqlite + sqlite3 --init /var/www/html/database/database.sql $DB_DATABASE + +#Use Composer to install PHP vendor packages, and compile the application for deployment +RUN export COMPOSER_HOME=/tmp && composer install --no-interaction --no-dev --optimize-autoloader + +#Use npm to install Javascript vendor packages, and compile the application for deployment +RUN export HOME=/tmp && npm install && npm run prod + +#Set default mode to standalone +RUN mv standalone.env .env + +#Needed for apache to run +USER root diff --git a/config.ini b/config.ini index 53a240bd..7650d6e2 100644 --- a/config.ini +++ b/config.ini @@ -11,7 +11,7 @@ versionNumberMin_type = f googleAnalyticsId = UA-463340-1 googleAnalyticsId_type = s [SQLValues] -databasePDO = 'sqlite:/home/arthur/src/ep-character-creator/database/database.sqlite' +databasePDO = 'sqlite:/var/www/html/database/database.sqlite' // databasePDO = "mysql:dbname=EclipsePhaseData;host=localhost;port=3306" databasePDO_type = s databaseUser = "epcc_www" diff --git a/docker/epcc/Dockerfile b/docker/epcc/Dockerfile deleted file mode 100644 index 3810da86..00000000 --- a/docker/epcc/Dockerfile +++ /dev/null @@ -1,6 +0,0 @@ -FROM php:7.2-apache - -RUN docker-php-ext-install pdo_mysql - -COPY php.ini /usr/local/etc/php/ -COPY epcc.ini /etc/epcc/config.ini diff --git a/docker/epcc/apache_host.conf b/docker/epcc/apache_host.conf deleted file mode 100644 index 078e3b29..00000000 --- a/docker/epcc/apache_host.conf +++ /dev/null @@ -1,6 +0,0 @@ - - DocumentRoot /var/www/html/public - - ErrorLog ${APACHE_LOG_DIR}/error.log - CustomLog ${APACHE_LOG_DIR}/access.log combined - diff --git a/docker/epcc/epcc.ini b/docker/epcc/epcc.ini deleted file mode 100644 index a8f28fa6..00000000 --- a/docker/epcc/epcc.ini +++ /dev/null @@ -1,96 +0,0 @@ -// Development Configuration file for Eclipse Phase Character Creator -[GeneralValues] -versionName = "Gate Prep" -versionName_type = s -releaseDate = "(May 2018)" -releaseDate_type = s -versionNumber = 1.50 -versionNumber_type = f -versionNumberMin = 0.91 -versionNumberMin_type = f -googleAnalyticsId = UA-463340-1 -googleAnalyticsId_type = s -[SQLValues] -databasePDO = "mysql:dbname=EclipsePhaseData;host=epcc-db;port=3306" -databasePDO_type = s -databaseUser = "epcc_www" -databaseUser_type = s -databasePassword = "0928sdGdsfa8#_+" -databasePassword_type = s -[RulesValues] -AptitudesPoint = 105 -AptitudesPoint_type = i -AptitudesMinValue = 5 -AptitudesMinValue_type = i -AptitudesMaxValue = 30 -AptitudesMaxValue_type = i -AbsoluteAptitudesMaxValue = 40 -AbsoluteAptitudesMaxValue_type = i -MoxieStartValue = 1 -MoxieStartValue_type = i -SpeedStartValue = 1 -SpeedStartValue_type = i -CreditStart = 5000; -CreditStart_type = i -RepStart = 50 -RepStart_type = i -CreationPoint = 1000 -CreationPoint_type = i -NativeTongueBaseValue = 70 -NativeTongueBaseValue_type = i -ActiveSkillsMinimum = 400 -ActiveSkillsMinimum_type = i -KnowledgeSkillsMinimum = 300 -KnowledgeSkillsMinimum_type = i -MoxiePointCost = 15 -MoxiePointCost_type = i -AptitudePointCost = 10 -AptitudePointCost_type = i -SpecializationPointCost = 5 -SpecializationPointCost_type = i -SkillPointUnderCost = 1 -SkillPointUnderCost_type = i -SkillPointUpperCost = 2 -SkillPointUpperCost_type = i -CreditPointCost = 0.001 -CreditPointCost_type = f -RepPointCost = 0.1 -RepPointCost_type = f -SkillMaxPoint = 80 -SkillMaxPoint_type = i -SkillEvolutionMaxPoint = 99 -SkillEvolutionMaxPoint_type = i -SkillMinPoint = 0 -SkillMinPoint_type = i -SkillLimitForImprove = 60 -SkillLimitForImprove_type = i -RepMaxPoint = 80 -RepMaxPoint_type = i -RepMinPoint = 0 -RepMinPoint_type = i -MoxMaxPoint = 8 -MoxMaxPoint_type = i -MoxEvoMaxPoint = 10 -MoxEvoMaxPoint_type = i -MoxMinPoint = 1 -MoxMinPoint_type = i -NativeTongueBonus = 60 -NativeTongueBonus_type = i -SpecializationCost = 5 -SpecializationCost_type = i -PsyCpCost = 5 -PsyCpCost_type = i -MaxPointPositiveTrait = 50 -MaxPointPositiveTrait_type = i -MaxPointNegativeTrait = 50 -MaxPointNegativeTrait_type = i -MaxPointNegativeTraitOnMorph = 25 -MaxPointNegativeTraitOnMorph_type = i -EvoMaxRepValue = 99 -EvoMaxRepValue_type = i -MaxCreditPurchaseWithCp = 100 -MaxCreditPurchaseWithCp_type = i -SpeedMaxValue = 4 -SpeedMaxValue_type = i - - diff --git a/docker/epcc/epcc_standalone.ini b/docker/epcc/epcc_standalone.ini deleted file mode 100644 index 41258087..00000000 --- a/docker/epcc/epcc_standalone.ini +++ /dev/null @@ -1,96 +0,0 @@ -// Development Configuration file for Eclipse Phase Character Creator -[GeneralValues] -versionName = "Gate Prep" -versionName_type = s -releaseDate = "(May 2018)" -releaseDate_type = s -versionNumber = 1.50 -versionNumber_type = f -versionNumberMin = 0.91 -versionNumberMin_type = f -googleAnalyticsId = UA-463340-1 -googleAnalyticsId_type = s -[SQLValues] -databasePDO = 'sqlite:/db/FullDatabase.sqlite' -databasePDO_type = s -databaseUser = "epcc_www" -databaseUser_type = s -databasePassword = "" -databasePassword_type = s -[RulesValues] -AptitudesPoint = 105 -AptitudesPoint_type = i -AptitudesMinValue = 5 -AptitudesMinValue_type = i -AptitudesMaxValue = 30 -AptitudesMaxValue_type = i -AbsoluteAptitudesMaxValue = 40 -AbsoluteAptitudesMaxValue_type = i -MoxieStartValue = 1 -MoxieStartValue_type = i -SpeedStartValue = 1 -SpeedStartValue_type = i -CreditStart = 5000; -CreditStart_type = i -RepStart = 50 -RepStart_type = i -CreationPoint = 1000 -CreationPoint_type = i -NativeTongueBaseValue = 70 -NativeTongueBaseValue_type = i -ActiveSkillsMinimum = 400 -ActiveSkillsMinimum_type = i -KnowledgeSkillsMinimum = 300 -KnowledgeSkillsMinimum_type = i -MoxiePointCost = 15 -MoxiePointCost_type = i -AptitudePointCost = 10 -AptitudePointCost_type = i -SpecializationPointCost = 5 -SpecializationPointCost_type = i -SkillPointUnderCost = 1 -SkillPointUnderCost_type = i -SkillPointUpperCost = 2 -SkillPointUpperCost_type = i -CreditPointCost = 0.001 -CreditPointCost_type = f -RepPointCost = 0.1 -RepPointCost_type = f -SkillMaxPoint = 80 -SkillMaxPoint_type = i -SkillEvolutionMaxPoint = 99 -SkillEvolutionMaxPoint_type = i -SkillMinPoint = 0 -SkillMinPoint_type = i -SkillLimitForImprove = 60 -SkillLimitForImprove_type = i -RepMaxPoint = 80 -RepMaxPoint_type = i -RepMinPoint = 0 -RepMinPoint_type = i -MoxMaxPoint = 8 -MoxMaxPoint_type = i -MoxEvoMaxPoint = 10 -MoxEvoMaxPoint_type = i -MoxMinPoint = 1 -MoxMinPoint_type = i -NativeTongueBonus = 60 -NativeTongueBonus_type = i -SpecializationCost = 5 -SpecializationCost_type = i -PsyCpCost = 5 -PsyCpCost_type = i -MaxPointPositiveTrait = 50 -MaxPointPositiveTrait_type = i -MaxPointNegativeTrait = 50 -MaxPointNegativeTrait_type = i -MaxPointNegativeTraitOnMorph = 25 -MaxPointNegativeTraitOnMorph_type = i -EvoMaxRepValue = 99 -EvoMaxRepValue_type = i -MaxCreditPurchaseWithCp = 100 -MaxCreditPurchaseWithCp_type = i -SpeedMaxValue = 4 -SpeedMaxValue_type = i - - diff --git a/docker/epcc/php.ini b/docker/epcc/php.ini deleted file mode 100644 index 2e67d331..00000000 --- a/docker/epcc/php.ini +++ /dev/null @@ -1,2 +0,0 @@ -; The timezone must be set or else the pdf exporter, and anything else that uses date functions, will fail. -date.timezone = "UTC" \ No newline at end of file diff --git a/standalone.env b/standalone.env new file mode 100644 index 00000000..868fae69 --- /dev/null +++ b/standalone.env @@ -0,0 +1,17 @@ +APP_NAME="Ecplise Phase Character Creator" +APP_ENV=local +APP_KEY=base64:Oxz5rzFAdaRpWuuKvEkyQwMFFyUDS/7Ol60gekDGDwg= +APP_DEBUG=true +APP_URL=http://localhost + +LOG_CHANNEL=stack + +DB_CONNECTION=sqlite + +BROADCAST_DRIVER=log +CACHE_DRIVER=file +SESSION_DRIVER=file +SESSION_LIFETIME=1440 +QUEUE_DRIVER=sync + +MIX_GOOGLE_ANALYTICS_ID="UA-463340-1"