File tree Expand file tree Collapse file tree 2 files changed +22
-11
lines changed Expand file tree Collapse file tree 2 files changed +22
-11
lines changed Original file line number Diff line number Diff line change 1
1
# Use the official PHP lightweight image with Apache
2
- FROM php:9.2 -apache
2
+ FROM php:8.3 -apache-bullseye
3
3
4
4
# Set working directory
5
5
WORKDIR /var/www/html
6
6
7
- # Copy project files
8
- COPY . .
9
-
10
- # Install system dependencies
7
+ # Install system dependencies for Laravel (GD, MySQL, etc.)
11
8
RUN apt-get update && apt-get install -y \
12
9
libpng-dev \
13
10
libjpeg-dev \
14
11
libfreetype6-dev \
15
12
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
16
13
&& docker-php-ext-install gd \
17
- && docker-php-ext-install pdo pdo_mysql
14
+ && docker-php-ext-install pdo pdo_mysql \
15
+ && apt-get clean
16
+
17
+ # Enable mod_rewrite for Apache (required for Laravel's clean URLs)
18
+ RUN a2enmod rewrite
19
+
20
+ # Configure Apache to allow overrides and access to the Laravel public directory
21
+ COPY ./apache/000-default.conf /etc/apache2/sites-available/000-default.conf
22
+
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 . .
18
29
19
30
# Install Composer
20
31
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
21
32
22
- # Install PHP dependencies
33
+ # Install PHP dependencies using Composer
23
34
RUN composer install --no-interaction --prefer-dist --optimize-autoloader
24
35
25
- # Expose port 80
36
+ # Expose port 80 for the Apache server
26
37
EXPOSE 80
27
38
28
- # Set entrypoint
29
- CMD ["apache2-foreground" ]
39
+ # Set the command to start Apache in the foreground
40
+ CMD ["apache2-foreground" ]
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ services:
6
6
context : .
7
7
dockerfile : Dockerfile
8
8
ports :
9
- - " 80 :80"
9
+ - " 8000 :80"
10
10
volumes :
11
11
- .:/var/www/html
12
12
env_file :
You can’t perform that action at this time.
0 commit comments