-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
37 lines (28 loc) · 873 Bytes
/
Copy pathDockerfile
File metadata and controls
37 lines (28 loc) · 873 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# Use the official PHP image with Apache
FROM php:8.1-apache
# Set working directory
WORKDIR /var/www/html
# Install required PHP extensions and dependencies
RUN apt-get update && apt-get install -y \
libpng-dev \
libjpeg-dev \
libfreetype6-dev \
zip \
unzip \
git \
curl \
&& docker-php-ext-install pdo pdo_mysql gd
# Enable Apache mod_rewrite
RUN a2enmod rewrite
# Copy application files
COPY . .
# Install Composer globally
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
# Install Laravel dependencies
RUN composer install --no-dev --optimize-autoloader
# Set permissions for Laravel storage and cache
RUN chown -R www-data:www-data /var/www/html/storage /var/www/html/bootstrap/cache
# Expose port 80 for HTTP traffic
EXPOSE 80
# Start Apache
CMD ["apache2-foreground"]