FROM ubuntu:22.04

# Avoid interactive prompts during install
ENV DEBIAN_FRONTEND=noninteractive

# Update system and install dependencies
RUN apt update && apt install -y \
    software-properties-common \
    curl \
    git \
    unzip \
    ca-certificates \
    lsb-release \
    gnupg \
    && rm -rf /var/lib/apt/lists/*

# Install PHP 8.4 and common extensions
RUN add-apt-repository ppa:ondrej/php -y && \
    apt update && apt install -y \
    php8.4 php8.4-cli php8.4-common php8.4-mbstring php8.4-xml \
    php8.4-curl php8.4-mysql php8.4-zip php8.4-bcmath && \
    rm -rf /var/lib/apt/lists/*

# Install Node.js 23.x + npm
RUN curl -fsSL https://deb.nodesource.com/setup_23.x | bash - && \
    apt install -y nodejs && \
    rm -rf /var/lib/apt/lists/*

# Install Yarn (latest)
RUN corepack enable && corepack prepare yarn@stable --activate

# Install Composer (latest)
RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" && \
    php composer-setup.php --install-dir=/usr/local/bin --filename=composer && \
    php -r "unlink('composer-setup.php');"

# Set working directory
WORKDIR /var/www/html

# Expose port for web server (if you want to add Apache/Nginx later)
EXPOSE 80

# Default command - keep container running
CMD ["bash"]

