Skip to content

Commit

Permalink
HOTFIX: Fix the Docker build
Browse files Browse the repository at this point in the history
  • Loading branch information
EmperorArthur committed Jan 10, 2019
1 parent 31cb116 commit f621889
Show file tree
Hide file tree
Showing 8 changed files with 66 additions and 217 deletions.
58 changes: 48 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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<Directory \/var\/www\/html\/>\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
2 changes: 1 addition & 1 deletion config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
6 changes: 0 additions & 6 deletions docker/epcc/Dockerfile

This file was deleted.

6 changes: 0 additions & 6 deletions docker/epcc/apache_host.conf

This file was deleted.

96 changes: 0 additions & 96 deletions docker/epcc/epcc.ini

This file was deleted.

96 changes: 0 additions & 96 deletions docker/epcc/epcc_standalone.ini

This file was deleted.

2 changes: 0 additions & 2 deletions docker/epcc/php.ini

This file was deleted.

17 changes: 17 additions & 0 deletions standalone.env
Original file line number Diff line number Diff line change
@@ -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"

0 comments on commit f621889

Please sign in to comment.