Files
michaelschiemer/docker/php/Dockerfile
Michael Schiemer 5050c7d73a docs: consolidate documentation into organized structure
- Move 12 markdown files from root to docs/ subdirectories
- Organize documentation by category:
  • docs/troubleshooting/ (1 file)  - Technical troubleshooting guides
  • docs/deployment/      (4 files) - Deployment and security documentation
  • docs/guides/          (3 files) - Feature-specific guides
  • docs/planning/        (4 files) - Planning and improvement proposals

Root directory cleanup:
- Reduced from 16 to 4 markdown files in root
- Only essential project files remain:
  • CLAUDE.md (AI instructions)
  • README.md (Main project readme)
  • CLEANUP_PLAN.md (Current cleanup plan)
  • SRC_STRUCTURE_IMPROVEMENTS.md (Structure improvements)

This improves:
 Documentation discoverability
 Logical organization by purpose
 Clean root directory
 Better maintainability
2025-10-05 11:05:04 +02:00

104 lines
2.9 KiB
Docker

# Dockerfile für PHP-FPM
FROM php:8.5-rc-fpm AS base
# System-Abhängigkeiten: Werden selten geändert, daher ein eigener Layer
RUN apt-get update && apt-get install -y \
git \
unzip \
libzip-dev \
zip \
libpng-dev \
libjpeg-dev \
libfreetype6-dev \
libwebp-dev \
libavif-dev \
libxpm-dev \
libsodium-dev \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
RUN docker-php-ext-configure gd \
--with-freetype \
--with-jpeg \
--with-webp \
--with-avif \
--with-xpm \
&& docker-php-ext-install -j$(nproc) gd
# Install PHP extensions (opcache and sodium are already built into PHP 8.5)
RUN docker-php-ext-install -j$(nproc) \
zip \
pdo \
pdo_mysql \
pcntl \
posix \
shmop \
bcmath
# Skip PECL extensions for PHP 8.5 RC compatibility
# RUN pecl install apcu redis \
# && docker-php-ext-enable apcu redis
# RUN echo "apc.enable_cli=1" >> /usr/local/etc/php/conf.d/docker-php-ext-apcu.ini \
# && echo "apc.shm_size=128M" >> /usr/local/etc/php/conf.d/docker-php-ext-apcu.ini
# Composer installieren
RUN curl -sS https://getcomposer.org/installer | php \
&& mv composer.phar /usr/local/bin/composer
# Installiere Xdebug nur im Entwicklungsmodus
ARG ENV=prod
RUN if [ "$ENV" = "dev" ]; then \
pecl install xdebug \
&& docker-php-ext-enable xdebug; \
fi
WORKDIR /var/www/html
# Composer Dependencies (für besseres Caching)
COPY composer.json ./
COPY composer.lock* ./
RUN composer install --no-scripts --no-autoloader --ignore-platform-reqs || \
(composer install --no-scripts --no-autoloader --no-dev --ignore-platform-reqs || \
echo "Composer install failed, continuing without dependencies")
# Kopiere PHP-Konfigurationen
COPY docker/php/php.common.ini /usr/local/etc/php/php.common.ini
COPY docker/php/php.${ENV}.ini /usr/local/etc/php/php.ini
# Xdebug-Konfiguration nur wenn dev
RUN if [ "$ENV" = "dev" ] && [ -f docker/php/xdebug.ini ]; then \
cp docker/php/xdebug.ini /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini; \
fi
# Kopiere den Rest des Projekts
COPY . .
# Optimiere Autoloader
RUN composer dump-autoload --optimize
# <<--- ALLE zusätzlichen System-Dateien und chmod noch als root!
COPY docker/php/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
RUN mkdir -p /var/www/html/cache \
/var/www/html/storage \
/var/www/html/storage/logs \
/var/www/html/storage/cache \
/var/www/html/storage/analytics \
/var/www/html/var \
/var/www/html/var/cache \
/var/www/html/var/logs
# Erstelle uploads-Verzeichnis
RUN mkdir -p /var/www/html/storage/uploads
# Danach erst den Nutzer wechseln!
RUN groupadd -g 1000 appuser && useradd -u 1000 -g appuser -m appuser
RUN chown -R appuser:appuser /var/www/html
USER appuser
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
CMD ["php-fpm"]