Files
thetool/docker/php/Dockerfile

30 lines
949 B
Docker

# Use Debian Bookworm as base image
FROM debian:bookworm
# Install apache2 and PHP and PHP modules
RUN apt update && \
apt install -y apache2 curl cron unzip php8.2 php8.2-curl php8.2-cli php8.2-mysqli php8.2-gd php8.2-zip php8.2-dom php8.2-mbstring && \
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer && \
apt clean && \
rm -rf /var/lib/apt/lists/*
# Enable PHP in Apache2
RUN a2enmod php8.2
RUN a2enmod rewrite
# Composer install
WORKDIR /var/www/html
COPY ../../composer.json ./
RUN composer install --no-interaction
COPY ./docker/php/clean_logs.sh /root/clean_logs.sh
RUN chmod +x /root/clean_logs.sh
# Add cron job for log cleanup
RUN echo "* * * * * /root/clean_old_logs.sh" > /etc/cron.d/clean_old_logs && \
chmod 0644 /etc/cron.d/clean_old_logs && \
crontab /etc/cron.d/clean_old_logs
# Start Apache in the foreground
CMD ["apachectl", "-D", "FOREGROUND"]