API updadte

This commit is contained in:
2025-11-09 10:15:40 +01:00
parent 5835eb15ed
commit 7548e241be
10 changed files with 156 additions and 235 deletions

View File

@@ -1,46 +1,57 @@
# Production-ready Symfony Dockerfile
FROM php:8.4-apache
# Install system dependencies
RUN apt-get update && apt-get install -y \
git \
curl \
RUN apt-get update && apt-get install -y --no-install-recommends \
libpng-dev \
libonig-dev \
libxml2-dev \
libicu-dev \
zip \
unzip \
libzip-dev \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
git \
curl \
unzip \
&& rm -rf /var/lib/apt/lists/*
# Install PHP extensions for Symfony
# Install PHP extensions needed by Symfony
RUN docker-php-ext-configure intl \
&& docker-php-ext-install pdo_mysql mysqli mbstring exif pcntl bcmath gd zip intl opcache
&& docker-php-ext-install -j$(nproc) \
pdo_mysql \
mbstring \
exif \
pcntl \
bcmath \
gd \
zip \
intl \
opcache
# Configure opcache for Symfony
RUN echo "opcache.enable=1" >> /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini \
&& echo "opcache.memory_consumption=256" >> /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini \
&& echo "opcache.max_accelerated_files=20000" >> /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini \
&& echo "opcache.validate_timestamps=0" >> /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini
# Enable Apache modules
RUN a2enmod rewrite headers
# Enable Apache mod_rewrite
RUN a2enmod rewrite
# Enable Apache headers module
RUN a2enmod headers
# Copy custom Apache configuration
# Copy Apache configuration
COPY ./docker/apache/000-default.conf /etc/apache2/sites-available/000-default.conf
# Install Composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
# Copy Composer from official image
COPY --from=composer:2 /usr/bin/composer /usr/bin/composer
# Set working directory
WORKDIR /var/www/html
# Change ownership
# Copy Symfony app
COPY . /var/www/html
# Optimize permissions
RUN chown -R www-data:www-data /var/www/html
# Configure opcache for production
RUN { \
echo "opcache.enable=1"; \
echo "opcache.memory_consumption=256"; \
echo "opcache.max_accelerated_files=20000"; \
echo "opcache.validate_timestamps=0"; \
} > /usr/local/etc/php/conf.d/opcache.ini
# Expose port 80
EXPOSE 80