This commit is contained in:
Jp
2026-02-26 13:36:40 +08:00
parent f635dabbc5
commit 3c251e9c3a

View File

@@ -1,13 +1,23 @@
# Using the slim version of 8.4; it's much more stable with Podman
FROM docker.io/php:8.4-fpm-alpine
WORKDIR /var/www
# Use the installer to get your specific extensions without the manual tar extraction
ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/
# We use the community repository to get pre-compiled PHP 8.4 extensions
# This skips the source-code extraction that is causing your permission errors
RUN apk add --no-cache \
php84-pecl-msgpack \
php84-pdo_mysql \
php84-mbstring \
php84-exif \
php84-pcntl \
php84-bcmath \
php84-gd \
php84-zip \
php84-intl \
icu-data-full
RUN chmod +x /usr/local/bin/install-php-extensions && \
install-php-extensions pdo_mysql mbstring exif pcntl bcmath gd zip intl
# Symlink the extensions so PHP can find them (Alpine puts them in a different path)
RUN ln -s /usr/lib/php84/modules/*.so /usr/local/lib/php/extensions/no-debug-non-zts-20240924/
# Get latest Composer
COPY --from=docker.io/composer:latest /usr/bin/composer /usr/bin/composer
@@ -15,9 +25,9 @@ COPY --from=docker.io/composer:latest /usr/bin/composer /usr/bin/composer
# Copy application files
COPY . /var/www
# Fix permissions for the www-data user
# Permission fix: Use a single RUN to reduce layer complexity
RUN chown -R www-data:www-data /var/www && \
chmod -R 755 /var/www/storage /var/www/bootstrap/cache
chmod -R 775 /var/www/storage /var/www/bootstrap/cache
USER www-data