From d6b5f0409c1a49e5ed18482ecd7f8f53a9a815f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vi=CC=81ctor=20Falco=CC=81n?= Date: Mon, 24 Nov 2025 16:07:46 +0100 Subject: [PATCH] Add Dockerfile for PHP 8.4-FPM environment setup --- Dockerfile | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..a91e298a --- /dev/null +++ b/Dockerfile @@ -0,0 +1,68 @@ +# Use the official PHP 8.4 FPM image +FROM php:8.4-fpm + +# Install system dependencies +RUN apt-get update && apt-get install -y \ + git \ + curl \ + libpng-dev \ + libonig-dev \ + libxml2-dev \ + libzip-dev \ + libicu-dev \ + zip \ + unzip \ + nginx \ + supervisor \ + libmemcached-dev \ + zlib1g-dev \ + && rm -rf /var/lib/apt/lists/* + +# Install PHP extensions +RUN docker-php-ext-install pdo_mysql mbstring exif pcntl bcmath gd zip intl +RUN pecl install memcached redis \ + && docker-php-ext-enable memcached redis + +# Install Composer +COPY --from=composer:latest /usr/bin/composer /usr/bin/composer + +# Install Node.js and pnpm +RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \ + && apt-get install -y nodejs \ + && npm install -g pnpm + +# Install memcached and redis servers +RUN apt-get update && apt-get install -y memcached redis-server && rm -rf /var/lib/apt/lists/* + +# Set working directory +WORKDIR /app + +# Copy application files +COPY . /app/. + +# Create necessary directories +RUN mkdir -p /var/log/nginx && mkdir -p /var/cache/nginx + +# Install PHP dependencies +RUN composer install --no-dev --optimize-autoloader + +# Install Node.js dependencies and build assets +RUN pnpm i --frozen-lockfile +RUN pnpm run build || echo "Build step failed, continuing..." + +# Copy supervisor configuration +COPY docker/supervisor/supervisord.conf /etc/supervisor/conf.d/supervisord.conf + +# Copy nginx configuration +COPY docker/nginx/nginx.conf /etc/nginx/nginx.conf + +# Set permissions +RUN chown -R www-data:www-data /app \ + && chmod -R 755 /app/storage \ + && chmod -R 755 /app/bootstrap/cache + +# Expose port +EXPOSE 80 + +# Start supervisor +CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]