nginx-dev/Dockerfile
kj ce0f70d648 Migrate to a docker-compose config with a few persistence.
./data/nginx/ for nginx host configurations.
./data/mysql/ for mysql databases.
2024-11-27 15:28:36 -04:00

50 lines
2.0 KiB
Docker

# Usamos Debian 13 como base
FROM docker.io/debian:trixie
# Instalamos systemd, mariadb, php, nginx, etc.
RUN apt-get update && \
apt-get install -y systemd systemd-sysv cron anacron nano wget curl git mariadb-server mariadb-client nginx php-fpm php-common php-gd php-mysql php-imap php-cli php-cgi libapache2-mod-fcgid apache2-suexec-pristine php-pear mcrypt imagemagick libruby libapache2-mod-python php-curl php-intl php-pspell php-sqlite3 php-tidy php-xmlrpc php-xsl memcached php-memcache php-imagick php-zip php-mbstring memcached libapache2-mod-passenger php-soap php-opcache php-apcu libapache2-reload-perl php-mcrypt && \
apt-get clean
# Mostrar los errores en PHP
RUN sed -i 's/display_errors = Off/display_errors = On/' /etc/php/8.2/fpm/php.ini && \
sed -i 's/error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT/error_reporting = E_ALL/' /etc/php/8.2/fpm/php.ini
# Eliminamos los logs de apt
RUN rm -rf \
/var/lib/apt/lists/* \
/var/log/alternatives.log \
/var/log/apt/history.log \
/var/log/apt/term.log \
/var/log/dpkg.log
# Habilitar servicios
RUN systemctl enable mariadb.service && \
systemctl enable php8.2-fpm.service && \
systemctl enable nginx.service
# Copiamos la configuración para un pool de PHP que corre como root
COPY php-root.conf /etc/php/8.2/fpm/pool.d/root.conf
# Habilitamos que PHP pueda correr como root
RUN sed -i 's/--nodaemonize/--nodaemonize --allow-to-run-as-root/' /usr/lib/systemd/system/php8.2-fpm.service
# Comandos para ejecutar dentro de docker y crear rápido configuraciones de dominios y subdominios
COPY bin/adddomain /usr/local/bin/adddomain
RUN chmod +x /usr/local/bin/adddomain
COPY bin/addsubdomain /usr/local/bin/addsubdomain
RUN chmod +x /usr/local/bin/addsubdomain
COPY bin/mysql_configure /usr/local/bin/mysql_configure
RUN chmod +x /usr/local/bin/mysql_configure
# Colocamos dentro el certificado SSL
COPY ssl /etc/nginx/ssl
# Configuración de puertos
EXPOSE 80
EXPOSE 443
# Use systemd as command
CMD [ "/sbin/init" ]