| FROM php:8.3-cli-alpine | |
| # Install system dependencies | |
| RUN apk add --no-cache \ | |
| git \ | |
| unzip \ | |
| libpng-dev \ | |
| libjpeg-turbo-dev \ | |
| freetype-dev \ | |
| libzip-dev \ | |
| icu-dev \ | |
| sqlite-dev | |
| # Configure and install PHP extensions | |
| RUN docker-php-ext-configure gd --with-freetype --with-jpeg \ | |
| && docker-php-ext-install -j$(nproc) \ | |
| gd \ | |
| zip \ | |
| intl \ | |
| pdo_mysql \ | |
| mysqli \ | |
| pdo_sqlite | |
| # Install Composer | |
| COPY --from=composer:2 /usr/bin/composer /usr/bin/composer | |
| # Set working directory | |
| WORKDIR /var/www/html | |
| # Copy application files (observing .hfignore) | |
| COPY . . | |
| # Run Composer Install to ensure all vendor dependencies exist (including platform-reqs since we installed extension libraries in the container) | |
| RUN composer install --no-dev --optimize-autoloader | |
| # Ensure proper permissions | |
| RUN chmod -R 777 /var/www/html | |
| # Expose port 7860 | |
| EXPOSE 7860 | |
| # Start PHP built-in web server with our router | |
| CMD ["php", "-S", "0.0.0.0:7860", "router.php"] | |