diff --git a/Prod.Dockerfile b/Prod.Dockerfile new file mode 100644 index 0000000..f6d29e1 --- /dev/null +++ b/Prod.Dockerfile @@ -0,0 +1,15 @@ +FROM php:8-fpm + +ENV LOGVIEW_INSTALLATION_PATH /app +ENV COMPOSER_ALLOW_SUPERUSER 1 +ENV APACHE_DOCUMENT_ROOT "${LOGVIEW_INSTALLATION_PATH}/app" +ENV APACHE_PUBLIC_ROOT "${LOGVIEW_INSTALLATION_PATH}/app/public" + +COPY --from=composer /usr/bin/composer /usr/bin/composer +WORKDIR "${LOGVIEW_INSTALLATION_PATH}" + +RUN apt-get update \ + && apt-get install -yq --no-install-recommends git \ + && rm -r /var/lib/apt/lists/* \ + && git clone http://git.provm.cl/ProVM/logview.git /app \ + && ${LOGVIEW_INSTALLATION_PATH}/install.sh diff --git a/app/.htaccess b/app/.htaccess new file mode 100644 index 0000000..659993e --- /dev/null +++ b/app/.htaccess @@ -0,0 +1,3 @@ +RewriteEngine on +RewriteRule ^$ public/ [L] +RewriteRule (.*) public/$1 [L] diff --git a/app/public/.htaccess b/app/public/.htaccess new file mode 100644 index 0000000..66ef8f6 --- /dev/null +++ b/app/public/.htaccess @@ -0,0 +1,4 @@ +RewriteEngine On +RewriteCond %{REQUEST_FILENAME} !-f +RewriteCond %{REQUEST_FILENAME} !-d +RewriteRule ^ index.php [QSA,L] diff --git a/install.sh b/install.sh new file mode 100644 index 0000000..8350b12 --- /dev/null +++ b/install.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +apt-get update +apt-get -yq --no-install-recommends zip unzip libzip-dev +rm -r /var/lib/apt/lists/* +docker-php-ext-install zip + +composer -d "${LOGVIEW_INSTALLATION_PATH}/app" install +mkdir "${LOGVIEW_INSTALLATION_PATH}/app/cache" +chmod -R 777 "${LOGVIEW_INSTALLATION_PATH}/app/cache" + +sed -ri -e 's!/var/www/html!${APACHE_PUBLIC_ROOT}!g' /etc/apache2/sites-available/*.conf +sed -ri -e 's!/var/www/!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf