1 changed files with 34 additions and 57 deletions
@ -1,78 +1,55 @@
|
||||
FROM php:7.4-apache |
||||
|
||||
# Instalar dependencias del sistema |
||||
RUN apt-get update && apt-get install -y \ |
||||
libpq-dev \ |
||||
libicu-dev \ |
||||
libzip-dev \ |
||||
libonig-dev \ |
||||
libfreetype6-dev \ |
||||
libjpeg62-turbo-dev \ |
||||
libpng-dev \ |
||||
git \ |
||||
unzip \ |
||||
&& rm -rf /var/lib/apt/lists/* |
||||
RUN apt-get update && apt-get install -y --no-install-recommends \ |
||||
$PHPIZE_DEPS \ |
||||
libpq-dev libicu-dev libzip-dev zlib1g-dev libonig-dev \ |
||||
libfreetype6-dev libjpeg62-turbo-dev libpng-dev \ |
||||
libcurl4-openssl-dev \ |
||||
git unzip curl ca-certificates \ |
||||
&& rm -rf /var/lib/apt/lists/* |
||||
|
||||
# Instalar extensiones PHP requeridas |
||||
RUN docker-php-ext-configure gd --with-freetype --with-jpeg \ |
||||
&& docker-php-ext-install -j$(nproc) \ |
||||
pdo_pgsql \ |
||||
mbstring \ |
||||
curl \ |
||||
openssl \ |
||||
apcu \ |
||||
gd \ |
||||
intl \ |
||||
zip |
||||
&& docker-php-ext-install -j"$(nproc)" \ |
||||
pdo_pgsql mbstring curl gd intl zip |
||||
|
||||
# Configurar PHP |
||||
RUN echo "max_input_vars = 2000" >> /usr/local/etc/php/conf.d/custom.ini \ |
||||
&& echo "allow_url_fopen = On" >> /usr/local/etc/php/conf.d/custom.ini \ |
||||
&& echo "memory_limit = 512M" >> /usr/local/etc/php/conf.d/custom.ini \ |
||||
&& echo "upload_max_filesize = 50M" >> /usr/local/etc/php/conf.d/custom.ini \ |
||||
&& echo "post_max_size = 50M" >> /usr/local/etc/php/conf.d/custom.ini |
||||
RUN pecl install apcu \ |
||||
&& docker-php-ext-enable apcu \ |
||||
&& apt-get purge -y --auto-remove $PHPIZE_DEPS || true |
||||
|
||||
# Instalar Composer |
||||
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer |
||||
RUN { \ |
||||
echo "max_input_vars = 2000"; \ |
||||
echo "allow_url_fopen = On"; \ |
||||
echo "memory_limit = 512M"; \ |
||||
echo "upload_max_filesize = 50M"; \ |
||||
echo "post_max_size = 50M"; \ |
||||
} > /usr/local/etc/php/conf.d/custom.ini |
||||
|
||||
# Instalar yui-compressor |
||||
RUN curl -L -o yuicompressor-2.4.8.jar https://github.com/yui/yuicompressor/releases/download/v2.4.8/yuicompressor-2.4.8.jar \ |
||||
&& mv yuicompressor-2.4.8.jar /usr/local/bin/yuicompressor.jar |
||||
COPY --from=composer:2 /usr/bin/composer /usr/bin/composer |
||||
|
||||
# Configurar Apache |
||||
RUN a2enmod rewrite \ |
||||
&& a2enmod headers \ |
||||
&& a2enmod ssl |
||||
RUN curl -L -o /usr/local/bin/yuicompressor.jar \ |
||||
https://github.com/yui/yuicompressor/releases/download/v2.4.8/yuicompressor-2.4.8.jar |
||||
|
||||
RUN a2enmod rewrite headers ssl |
||||
|
||||
# Crear directorio de trabajo |
||||
WORKDIR /var/www/html |
||||
|
||||
# Copiar archivos del proyecto |
||||
COPY . /var/www/html/ |
||||
# Copiar código directamente con dueño correcto |
||||
COPY --chown=www-data:www-data . /var/www/html/ |
||||
|
||||
# Instalar dependencias de Composer |
||||
RUN composer install --prefer-dist --no-dev --optimize-autoloader |
||||
RUN composer install --prefer-dist --no-dev --optimize-autoloader || true |
||||
|
||||
# Configurar permisos |
||||
RUN chown -R www-data:www-data /var/www/html \ |
||||
&& chmod -R 755 /var/www/html \ |
||||
&& mkdir -p /var/www/html/instalacion/temp \ |
||||
&& mkdir -p /var/www/html/instalacion/log \ |
||||
&& mkdir -p /var/www/html/instalacion/cache \ |
||||
&& chown -R www-data:www-data /var/www/html/instalacion/temp \ |
||||
&& chown -R www-data:www-data /var/www/html/instalacion/log \ |
||||
&& chown -R www-data:www-data /var/www/html/instalacion/cache \ |
||||
&& chmod -R 777 /var/www/html/instalacion/temp \ |
||||
&& chmod -R 777 /var/www/html/instalacion/log \ |
||||
&& chmod -R 777 /var/www/html/instalacion/cache |
||||
# Crear solo carpetas necesarias con permisos |
||||
RUN mkdir -p /var/www/html/instalacion/{temp,log,cache} \ |
||||
&& chown -R www-data:www-data /var/www/html/instalacion/{temp,log,cache} \ |
||||
&& chmod -R 777 /var/www/html/instalacion/{temp,log,cache} |
||||
|
||||
# Configurar Apache para el proyecto |
||||
COPY docker/apache-config.conf /etc/apache2/sites-available/000-default.conf |
||||
|
||||
# Script de inicialización |
||||
# Copiar rewrite.conf (asegurar ruta correcta) |
||||
COPY instalacion/rewrite.conf /var/www/html/instalacion/rewrite.conf |
||||
|
||||
COPY docker/init.sh /usr/local/bin/init.sh |
||||
RUN chmod +x /usr/local/bin/init.sh |
||||
|
||||
EXPOSE 80 |
||||
|
||||
CMD ["/usr/local/bin/init.sh"] |
||||
|
||||
Loading…
Reference in new issue