Dockerfile 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. FROM php:8.3-apache
  2. RUN apt-get update && apt-get install -y --no-install-recommends \
  3. libsqlite3-dev unzip git \
  4. && docker-php-ext-install pdo pdo_sqlite \
  5. && a2enmod rewrite \
  6. && rm -rf /var/lib/apt/lists/*
  7. COPY --from=composer:2 /usr/bin/composer /usr/bin/composer
  8. WORKDIR /var/www/html
  9. COPY composer.json composer.lock* ./
  10. RUN composer install --no-dev --no-interaction --prefer-dist --no-progress
  11. COPY . .
  12. # Write a clean Apache site config pointing at public/ and routing every
  13. # unmatched URL to the front controller via FallbackResource. That replaces
  14. # the need for .htaccess rewrites (the .htaccess is kept as defense-in-depth
  15. # for deployments that don't use this image).
  16. RUN mkdir -p /var/www/data /var/www/data/sessions \
  17. && chown -R www-data:www-data /var/www/data \
  18. && printf '%s\n' \
  19. '<VirtualHost *:80>' \
  20. ' DocumentRoot /var/www/html/public' \
  21. ' <Directory /var/www/html/public>' \
  22. ' Options -Indexes +FollowSymLinks' \
  23. ' AllowOverride All' \
  24. ' Require all granted' \
  25. ' FallbackResource /index.php' \
  26. ' </Directory>' \
  27. ' ErrorLog ${APACHE_LOG_DIR}/error.log' \
  28. ' CustomLog ${APACHE_LOG_DIR}/access.log combined' \
  29. '</VirtualHost>' \
  30. > /etc/apache2/sites-available/000-default.conf
  31. EXPOSE 80
  32. CMD ["apache2-foreground"]