-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
56 lines (44 loc) · 1.59 KB
/
Copy pathDockerfile
File metadata and controls
56 lines (44 loc) · 1.59 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
FROM php:8.4-fpm
# Install system dependencies, PHP extensions, and Nginx
RUN apt-get update && apt-get install -y \
git \
curl \
libpng-dev \
libonig-dev \
libxml2-dev \
zip \
unzip \
nginx \
&& docker-php-ext-install pdo_mysql mysqli opcache \
&& docker-php-ext-enable pdo_mysql mysqli opcache \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Configure PHP 8.4 optimizations
RUN echo "opcache.enable=1" >> /usr/local/etc/php/conf.d/opcache.ini \
&& echo "opcache.memory_consumption=256" >> /usr/local/etc/php/conf.d/opcache.ini \
&& echo "opcache.interned_strings_buffer=16" >> /usr/local/etc/php/conf.d/opcache.ini \
&& echo "opcache.max_accelerated_files=20000" >> /usr/local/etc/php/conf.d/opcache.ini \
&& echo "opcache.validate_timestamps=0" >> /usr/local/etc/php/conf.d/opcache.ini
# Install Composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
# Copy Nginx configuration
COPY nginx/nginx.conf /etc/nginx/sites-available/default
# Set working directory
WORKDIR /var/www/html
# Copy application files
COPY . /var/www/html
# Install PHP dependencies (with dev dependencies for development)
RUN composer install
# Set proper permissions
RUN chown -R www-data:www-data /var/www/html \
&& chmod -R 755 /var/www/html \
&& mkdir -p /var/www/html/storage/cache/views \
&& chown -R www-data:www-data /var/www/html/storage \
&& chmod -R 775 /var/www/html/storage
# Copy startup script
COPY scripts/start.sh /start.sh
RUN chmod +x /start.sh
# Expose port 80
EXPOSE 80
# Start Nginx and PHP-FPM
CMD ["/start.sh"]