FROM debian:latest AS builder # Install dependencies RUN apt-get update && apt-get install -y \ curl \ wget \ gnupg2 \ lsb-release \ ca-certificates \ apt-transport-https \ software-properties-common \ nginx \ unzip # Add PHP repository RUN wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg \ && echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list # Install PHP 8.4 RUN apt-get update && apt-get install -y \ php8.4 \ php8.4-cli \ php8.4-common \ php8.4-curl \ php8.4-mbstring \ php8.4-mysql \ php8.4-xml \ php8.4-zip \ php8.4-bcmath \ php8.4-intl \ php8.4-gd \ php8.4-fpm \ php8.4-pgsql # Install Composer RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer # Install Node.js and npm RUN curl -fsSL https://deb.nodesource.com/setup_current.x | bash - \ && apt-get install -y nodejs # Configure PHP-FPM RUN sed -i 's/listen = \/run\/php\/php8.4-fpm.sock/listen = 9000/g' /etc/php/8.4/fpm/pool.d/www.conf # Configure Nginx RUN mkdir -p /etc/nginx/sites-available # Clean up RUN apt-get clean && rm -rf /var/lib/apt/lists/* # Set working directory WORKDIR /var/www/html # Copy entrypoint script COPY docker/entrypoint.sh /entrypoint.sh RUN chmod +x /entrypoint.sh FROM builder AS dev # Set entrypoint ENTRYPOINT ["/entrypoint.sh"] FROM builder AS prod COPY . /var/www/html WORKDIR /var/www/html RUN cd backend && composer install RUN cd frontend && npm install && npm run build # Set entrypoint ENTRYPOINT ["/entrypoint.sh"]