|
1 |
| -# Use the official PHP lightweight image with Apache |
| 1 | +# Use the official PHP image with Apache |
2 | 2 | FROM php:8.3-apache-bullseye
|
3 | 3 |
|
4 | 4 | # Set working directory
|
5 | 5 | WORKDIR /var/www/html
|
6 | 6 |
|
7 |
| -# Install system dependencies for Laravel (GD, MySQL, etc.) |
| 7 | +# Install system dependencies |
8 | 8 | RUN apt-get update && apt-get install -y \
|
| 9 | + git \ |
| 10 | + zip \ |
| 11 | + unzip \ |
9 | 12 | libpng-dev \
|
10 | 13 | libjpeg-dev \
|
11 | 14 | libfreetype6-dev \
|
12 | 15 | && docker-php-ext-configure gd --with-freetype --with-jpeg \
|
13 | 16 | && docker-php-ext-install gd \
|
14 |
| - && docker-php-ext-install pdo pdo_mysql \ |
15 |
| - && apt-get clean |
| 17 | + && docker-php-ext-install pdo pdo_mysql |
16 | 18 |
|
17 |
| -# Enable mod_rewrite for Apache (required for Laravel's clean URLs) |
| 19 | +# Enable Apache mod_rewrite |
18 | 20 | RUN a2enmod rewrite
|
19 | 21 |
|
20 |
| -# Configure Apache to allow overrides and access to the Laravel public directory |
| 22 | +# Copy Apache configuration (if you have a custom one) |
21 | 23 | COPY ./apache/000-default.conf /etc/apache2/sites-available/000-default.conf
|
22 | 24 |
|
23 |
| -# Set correct permissions for the Laravel files |
24 |
| -RUN chown -R www-data:www-data /var/www/html |
25 |
| -RUN chmod -R 755 /var/www/html |
26 |
| - |
27 |
| -# Copy the project files into the container |
28 |
| -COPY . . |
29 |
| - |
30 | 25 | # Install Composer
|
31 | 26 | COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
|
32 | 27 |
|
33 |
| -# Install PHP dependencies using Composer |
| 28 | +# Copy project files |
| 29 | +COPY . . |
| 30 | + |
| 31 | +# Install PHP dependencies |
34 | 32 | RUN composer install --no-interaction --prefer-dist --optimize-autoloader
|
35 | 33 |
|
36 |
| -# Expose port 80 for the Apache server |
| 34 | +# Expose port 80 |
37 | 35 | EXPOSE 80
|
38 | 36 |
|
39 |
| -# Set the command to start Apache in the foreground |
| 37 | +# Start Apache |
40 | 38 | CMD ["apache2-foreground"]
|
0 commit comments