64 lines
1.7 KiB
Docker
64 lines
1.7 KiB
Docker
FROM ubuntu:24.04
|
|
|
|
# Instalar Nginx
|
|
RUN apt-get update && apt-get install -y nginx software-properties-common curl unzip supervisor
|
|
RUN add-apt-repository ppa:ondrej/php && apt-get update
|
|
|
|
# Exponer el puerto 80 y 443 para HTTP
|
|
EXPOSE 80
|
|
EXPOSE 443
|
|
|
|
RUN ln -sf /dev/stdout /var/log/nginx/access.log \
|
|
&& ln -sf /dev/stderr /var/log/nginx/error.log \
|
|
&& ln -sf /dev/stderr /var/log/php8.2-fpm.log
|
|
|
|
|
|
# Copia la configuración personalizada de Nginx al contenedor
|
|
COPY ./docker/nginx/default.conf /etc/nginx/sites-available/oggit
|
|
|
|
# Borrar default.conf en nginx en caso de que exista
|
|
RUN rm /etc/nginx/sites-enabled/default
|
|
|
|
# Crear un enlace simbólico a sites-enabled
|
|
RUN ln -s /etc/nginx/sites-available/oggit /etc/nginx/sites-enabled/oggit
|
|
|
|
# Install php 8.2 and php-fpm
|
|
|
|
RUN apt-get install -y php8.2 php8.2-cli php8.2-fpm php8.2-xml php8.2-curl
|
|
|
|
# Install composer
|
|
|
|
RUN curl -sS https://getcomposer.org/installer -o composer-setup.php && php composer-setup.php --install-dir=/usr/local/bin --filename=composer
|
|
|
|
|
|
# Crear directorio de trabajo
|
|
RUN mkdir /opt/oggit
|
|
RUN mkdir -p /var/www/.composer && chown -R www-data:www-data /var/www
|
|
|
|
|
|
WORKDIR /opt/oggit
|
|
# Copy the project to /opt/oggit
|
|
COPY src/ src/
|
|
COPY config/ config/
|
|
COPY composer.json .
|
|
|
|
# Install dependencies
|
|
RUN composer install
|
|
COPY .env .env
|
|
RUN chown -R www-data:www-data /opt/oggit
|
|
|
|
# Configure Supervisor
|
|
COPY docker/supervisord/supervisor.conf /etc/supervisor/conf.d/supervisor.conf
|
|
# Iniciar Nginx
|
|
COPY docker/entrypoint/entrypoint.sh /entrypoint.sh
|
|
|
|
# Cambiar los permisos de entrypoint.sh
|
|
RUN chmod +x /entrypoint.sh
|
|
RUN mkdir -p /run/php && chown -R www-data:www-data /run/php
|
|
|
|
|
|
# Set entrypoint
|
|
CMD ["/entrypoint.sh"]
|
|
|
|
|