Last active
July 18, 2025 14:18
-
-
Save angelbladex/030f3c6dde3877c63f0305cc70f31ee0 to your computer and use it in GitHub Desktop.
Dockerfile para crear un contenedor de Php 5.2 con Apache desde Ubuntu 20.04 sin compilar
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM ubuntu:20.04 | |
# Configura zona horaria automáticamente para evitar prompts | |
ENV DEBIAN_FRONTEND=noninteractive | |
RUN ln -fs /usr/share/zoneinfo/America/Caracas /etc/localtime && \ | |
echo "America/Caracas" > /etc/timezone | |
# Configura repositorios base | |
RUN echo "" > /etc/apt/sources.list && \ | |
echo "deb http://ve.archive.ubuntu.com/ubuntu focal main restricted universe multiverse" >> /etc/apt/sources.list && \ | |
echo "deb http://ve.archive.ubuntu.com/ubuntu focal-security main restricted universe multiverse" >> /etc/apt/sources.list && \ | |
echo "deb http://ve.archive.ubuntu.com/ubuntu focal-updates main restricted universe multiverse" >> /etc/apt/sources.list && \ | |
echo "deb http://ve.archive.ubuntu.com/ubuntu focal-proposed main restricted universe multiverse" >> /etc/apt/sources.list && \ | |
echo "deb http://ve.archive.ubuntu.com/ubuntu focal-backports main restricted universe multiverse" >> /etc/apt/sources.list && \ | |
apt-get update | |
RUN apt-get dist-upgrade -y | |
# Añade repositorio PHP 5.2 (con enfoque moderno para claves GPG) | |
RUN apt-get install -y gnupg2 curl && \ | |
curl -fsSL "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0xCD44D3EE9CE1C29A" | gpg --dearmor -o /usr/share/keyrings/php52.gpg && \ | |
echo "deb [signed-by=/usr/share/keyrings/php52.gpg] http://ppa.launchpad.net/sergey-dryabzhinsky/php52/ubuntu focal main" > /etc/apt/sources.list.d/php52.list && \ | |
apt-get update | |
# Instala paquetes necesarios | |
RUN apt-get install -y \ | |
apache2 \ | |
libapache2-mod-php52 \ | |
php52-mod-pgsql \ | |
php52-mod-gd \ | |
php52-mod-xmlreader \ | |
php52-mod-mcrypt \ | |
php52-mod-mbstring \ | |
php52-mod-json \ | |
php52-mod-curl \ | |
php52-mod-zendoptimizer | |
COPY config/000-default.conf /etc/apache2/sites-available/000-default.conf | |
COPY config/php.ini /etc/php52/apache2/php.ini | |
RUN service apache2 stop | |
RUN rm -r /var/www/html/ | |
COPY code/System /var/www/System | |
RUN chown -R www-data:www-data /var/www/System | |
RUN cd /var/www/ ; find . -type d ! -perm 775 -exec chmod 775 {} \; | |
RUN cd /var/www/ ; find . -type f ! -perm 664 -exec chmod 664 {} \; | |
RUN a2dismod mpm_event | |
RUN a2dismod mpm_worker | |
RUN a2enmod mpm_prefork | |
RUN a2enmod php52 | |
RUN php5-modset -e 02-mbstring 99-ZendOptimizer curl dom gd gettext json mcrypt pcntl pdo_pgsql pgsql xmlreader | |
# Limpieza para reducir tamaño de imagen | |
RUN apt-get clean && rm -rf /var/lib/apt/lists/* | |
# Restaura el valor por defecto (opcional) | |
ENV DEBIAN_FRONTEND=dialog | |
EXPOSE 80 | |
# Comando para iniciar Apache en primer plano | |
CMD ["apache2ctl", "-D", "FOREGROUND"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment