kenken999/php
0
1# Use the official PHP image with PHP 8.12FROM php:8.1-apache3 4# Install necessary packages and PHP extensions5RUN apt-get update && apt-get install -y \6 wget \7 git \8 gnupg \9 lsb-release \10 apt-transport-https \11 ca-certificates \12 libpq-dev \13 libsqlite3-dev \14 zip \15 unzip \16 && docker-php-ext-install pgsql pdo_pgsql pdo_sqlite mysqli pdo_mysql17 18# Install Composer19COPY --from=composer:latest /usr/bin/composer /usr/bin/composer20 21# Copy the Laravel project into the container22COPY ./php/ /var/www/html23 24# Ensure .env file is copied25COPY ./php/.env /var/www/html/.env26 27# Run composer update to ensure compatible versions of dependencies28RUN composer update --working-dir=/var/www/html --no-scripts29 30# Set Apache DocumentRoot to Laravel's public directory31RUN sed -i 's|/var/www/html|/var/www/html/public|' /etc/apache2/sites-available/000-default.conf32 33# Change Apache to listen on port 786034RUN sed -i 's/Listen 80/Listen 7860/' /etc/apache2/ports.conf \35 && sed -i 's/:80/:7860/' /etc/apache2/sites-available/000-default.conf36 37# Set correct permissions for Laravel directories38RUN chown -R www-data:www-data /var/www/html \39 && find /var/www/html -type d -exec chmod 755 {} \; \40 && find /var/www/html -type f -exec chmod 644 {} \;41 42# Ensure the storage and cache directories have the correct permissions43RUN mkdir -p /var/www/html/storage \44 && mkdir -p /var/www/html/bootstrap/cache \45 && chown -R www-data:www-data /var/www/html/storage \46 && chown -R www-data:www-data /var/www/html/bootstrap/cache \47 && chmod -R 775 /var/www/html/storage \48 && chmod -R 775 /var/www/html/bootstrap/cache49 50# Expose the Apache port51EXPOSE 786052 53# Start Apache54CMD ["apache2-foreground"]