fix: migrate Dockerfile to php:8.4-fpm-alpine to restore native IMAP support

This commit is contained in:
idevakk
2026-02-28 23:43:51 +05:30
parent 66b5d2f89e
commit 7f58ca9f45

View File

@@ -1,25 +1,31 @@
FROM php:8.4-fpm FROM php:8.4-fpm-alpine
# Install system dependencies # Install system dependencies
RUN apt-get update && apt-get install -y \ RUN apk add --no-cache \
git \ git \
curl \ curl \
libpng-dev \ libpng-dev \
libonig-dev \ oniguruma-dev \
libxml2-dev \ libxml2-dev \
zip \ zip \
unzip \ unzip \
nginx \ nginx \
supervisor \ supervisor \
libc-client-dev \ imap-dev \
libkrb5-dev \ krb5-dev \
&& rm -rf /var/lib/apt/lists/* linux-headers \
nodejs \
npm \
bash \
icu-dev \
$PHPIZE_DEPS
# Configure and install PHP extensions # Configure and install PHP extensions
RUN docker-php-ext-configure imap --with-kerberos --with-imap-ssl \ RUN docker-php-ext-configure imap --with-kerberos --with-imap-ssl \
&& docker-php-ext-install pdo_mysql mbstring exif pcntl bcmath gd intl imap \ && docker-php-ext-install pdo_mysql mbstring exif pcntl bcmath gd intl imap \
&& pecl install redis \ && pecl install redis \
&& docker-php-ext-enable redis && docker-php-ext-enable redis \
&& apk del $PHPIZE_DEPS
# Install Composer # Install Composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
@@ -30,28 +36,27 @@ WORKDIR /var/www
# Copy existing application directory contents # Copy existing application directory contents
COPY . /var/www COPY . /var/www
# Install PHP dependencies # Install PHP/Node dependencies and build frontend
RUN composer install --no-interaction --no-dev --optimize-autoloader RUN composer install --no-interaction --no-dev --optimize-autoloader \
&& npm install \
&& npm run build \
&& npm cache clean --force
# Nginx config # Nginx config
COPY .docker/nginx.conf /etc/nginx/sites-available/default # Alpine uses http.d instead of sites-available
RUN rm -rf /etc/nginx/sites-enabled/default && ln -s /etc/nginx/sites-available/default /etc/nginx/sites-enabled/default COPY .docker/nginx.conf /etc/nginx/http.d/default.conf
# Supervisor config # Supervisor config
RUN mkdir -p /etc/supervisor/conf.d /var/log/supervisor
COPY .docker/supervisord.conf /etc/supervisor/conf.d/supervisord.conf COPY .docker/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
# Set directory permissions # Set directory permissions
RUN chown -R www-data:www-data /var/www/storage /var/www/bootstrap/cache \ RUN mkdir -p /run/nginx /var/lib/nginx \
&& chown -R www-data:www-data /var/www \
&& chown -R www-data:www-data /var/lib/nginx \
&& chown -R www-data:www-data /run/nginx \
&& chmod -R 775 /var/www/storage /var/www/bootstrap/cache && chmod -R 775 /var/www/storage /var/www/bootstrap/cache
# Build frontend assets
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
&& apt-get install -y nodejs \
&& npm install \
&& npm run build \
&& apt-get remove -y nodejs \
&& apt-get autoremove -y
EXPOSE 80 EXPOSE 80
# Configure entrypoint # Configure entrypoint