Files
MKM/Dockerfile
Jp 49226f8aa1 build: simplify Dockerfile using extension installer
- Replace manual apk install and docker-php-ext-install with mlocati/docker-php-extension-installer
- Combine system dependency installation and PHP extension setup into a single step
- Reorder steps for better clarity: copy files before permission fixes
- Maintain same PHP extensions and final permissions
2026-02-26 13:27:58 +08:00

30 lines
988 B
Docker

FROM php:8.4-fpm-alpine
WORKDIR /var/www
# Install the PHP extension installer helper
ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/
# Install system dependencies and PHP extensions in one go
# This script handles the 'apk add' and 'apk del' for dev-libraries automatically
RUN chmod +x /usr/local/bin/install-php-extensions && \
install-php-extensions pdo_mysql mbstring exif pcntl bcmath gd zip intl
# Get latest Composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
# Copy application files
COPY . /var/www
# Fix permissions
# We do this as root before switching to the unprivileged user
RUN chown -R www-data:www-data /var/www && \
find /var/www -type d -exec chmod 755 {} + && \
find /var/www -type f -exec chmod 644 {} + && \
rm -rf /var/www/.circleci /var/www/.github
USER www-data
EXPOSE 8000
CMD ["php", "artisan", "serve", "--host=0.0.0.0", "--port=8000"]