Last active
September 3, 2025 19:59
-
-
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
| services: | |
| YourContainerName: | |
| build: . | |
| ports: | |
| - "80:80" | |
| volumes: | |
| - ./code/YourSystem:/var/www/YourSystem | |
| - ./config/php.ini:/etc/php52/apache2/php.ini | |
| - ./config/000-default.conf:/etc/apache2/sites-available/000-default.conf | |
| restart: unless-stopped | |
| networks: | |
| YourNetwork_net: | |
| ipv4_address: 10.11.12.14 # IP fija | |
| networks: | |
| YourNetwork_net: | |
| driver: bridge | |
| ipam: | |
| config: | |
| - subnet: "10.11.12.12/30" # Define la subred |
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 y repositorios en una sola capa | |
| ENV DEBIAN_FRONTEND=noninteractive | |
| RUN ln -fs /usr/share/zoneinfo/America/Caracas /etc/localtime && \ | |
| echo "America/Caracas" > /etc/timezone && \ | |
| 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 && \ | |
| apt-get dist-upgrade -y | |
| # Instala dependencias y configura repositorio PHP 5.2 en una sola capa | |
| RUN apt-get install -y --no-install-recommends ca-certificates gnupg2 curl && \ | |
| curl -fsSL "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x5baca02e04af8135" | gpg --dearmor -o /usr/share/keyrings/sergey-php52.gpg && \ | |
| echo "deb [signed-by=/usr/share/keyrings/sergey-php52.gpg] https://ppa.launchpadcontent.net/sergey-dryabzhinsky/php52/ubuntu focal main" > /etc/apt/sources.list.d/php52.list && \ | |
| apt-get update && \ | |
| apt-get dist-upgrade -y | |
| # Instala todos los paquetes necesarios y configura Apache/PHP en una sola capa | |
| RUN apt-get install -y --no-install-recommends \ | |
| 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-gettext \ | |
| php52-mod-zendoptimizer && \ | |
| rm -rf /var/www/html/ && \ | |
| mkdir -p /var/www/YourSystem && \ | |
| a2dismod mpm_event && \ | |
| a2dismod mpm_worker && \ | |
| a2enmod mpm_prefork && \ | |
| a2enmod php52 && \ | |
| php5-modset -e 02-mbstring 99-ZendOptimizer curl dom gd gettext json mcrypt pcntl pdo_pgsql pgsql xmlreader && \ | |
| chown -R www-data:www-data /var/www/YourSystem && \ | |
| chmod -R 775 //var/www/YourSystem && \ | |
| apt-get clean && \ | |
| rm -rf /var/lib/apt/lists/* | |
| RUN echo "ServerName localhost" >> /etc/apache2/apache2.conf | |
| RUN sed -i 's/^ServerTokens OS/ServerTokens Prod/' /etc/apache2/conf-available/security.conf | |
| RUN sed -i 's/^ServerSignature On/ServerSignature Off/' /etc/apache2/conf-available/security.conf | |
| RUN a2enconf security | |
| EXPOSE 80 | |
| CMD ["apache2ctl", "-D", "FOREGROUND"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment