# Use the official PHP image with Apache FROM php:8.1-apache # Install system dependencies RUN apt-get update && apt-get install -y libpng-dev libjpeg-dev libfreetype6-dev libzip-dev unzip git # Install PHP extensions RUN docker-php-ext-configure gd --with-freetype --with-jpeg \ && docker-php-ext-install gd \ && docker-php-ext-install zip pdo pdo_mysql # Enable Apache mod_rewrite RUN a2enmod rewrite # Copy custom Apache ServerName configuration file COPY servername.conf /etc/apache2/conf-available/servername.conf RUN a2enconf servername # Update Apache to listen on port 15011 RUN sed -i 's/80/15011/g' /etc/apache2/ports.conf # Copy the Laravel application code into the container COPY . /var/www/html # Set the working directory WORKDIR /var/www/html # Install Composer (PHP dependency manager) COPY --from=composer:latest /usr/bin/composer /usr/bin/composer # Install PHP dependencies using Composer RUN composer install --no-dev --optimize-autoloader # Set file permissions (adjust as needed for your setup) RUN chown -R www-data:www-data /var/www/html/storage /var/www/html/bootstrap/cache # Install tzdata to set the timezone RUN apt-get update && apt-get install -y tzdata # Set the timezone to Manila ENV TZ=Asia/Manila # Make sure the timezone is updated RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone # Install cron RUN apt-get update && apt-get -y install cron # Copy Laravel's cron entry to the container's crontab COPY ./cronfile /etc/cron.d/laravel-cron # Give execution rights on the cron job RUN chmod 0644 /etc/cron.d/laravel-cron # Apply cron job RUN crontab /etc/cron.d/laravel-cron # Create the log file to be able to run tail RUN touch /var/log/cron.log # Run the cron service CMD cron && tail -f /var/log/cron.log # Expose port 15011 EXPOSE 15011