app/backend/Dockerfile

36 lines
845 B
Text
Raw Permalink Normal View History

2025-10-13 14:57:11 +02:00
# Use official PHP base with required extensions
FROM php:8.2-fpm
# Install system dependencies & PHP extensions
RUN apt-get update && apt-get install -y \
git unzip curl libzip-dev libpng-dev libonig-dev libxml2-dev zip \
&& docker-php-ext-install pdo pdo_mysql zip mbstring exif pcntl bcmath
# Install Composer globally
COPY --from=composer:2 /usr/bin/composer /usr/bin/composer
# Set working dir
WORKDIR /var/www
# Copy app files
COPY . .
# Install PHP dependencies
RUN composer install --no-dev --optimize-autoloader
# Laravel optimizations
RUN php artisan config:cache \
&& php artisan route:cache \
&& php artisan view:cache
# Set correct permissions
RUN chown -R www-data:www-data /var/www \
&& chmod -R 755 /var/www/storage
USER www-data
# Expose port 9000 (default for php-fpm)
EXPOSE 9000
CMD ["php-fpm"]