-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdockerfile
More file actions
38 lines (28 loc) · 847 Bytes
/
dockerfile
File metadata and controls
38 lines (28 loc) · 847 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
38
# Base Image
FROM php:8.1-apache
# Set working directory
WORKDIR /var/www/html
# Install necessary PHP extensions and dependencies
RUN apt-get update && apt-get install -y \
default-mysql-client \
git \
unzip \
&& docker-php-ext-install pdo pdo_mysql
# Install Composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
# Enable Apache mod_rewrite for clean URLs
RUN a2enmod rewrite
# Copy composer files
COPY composer.json composer.lock* /var/www/
# Install dependencies
WORKDIR /var/www
RUN composer install --no-dev --optimize-autoloader
# Copy application files to the container
COPY src/ /var/www/html
# Set file permissions for Apache
RUN chown -R www-data:www-data /var/www/html && \
chmod -R 755 /var/www/html
# Expose port 80 for HTTP
EXPOSE 80
# Start Apache server
CMD ["apache2-foreground"]