# Use an official PHP runtime as a parent image
FROM php:8.1-fpm

# Set the working directory to /var/www/html
WORKDIR /var/www/html/Servidor/MigAndFac

# Copy the current directory contents into the container at /var/www/html
COPY . .

# Install Composer
RUN apt-get update && \
    apt-get install -y --no-install-recommends \
        git \
        unzip \
        && \
    curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/*

# Install PHP extensions and dependencies
# (Add any additional extensions or dependencies your application needs)
RUN docker-php-ext-install pdo pdo_mysql

# Run Composer install
RUN composer install --optimize-autoloader --no-dev

# Make port 9000 available to the world outside this container
EXPOSE 9000

# Define environment variable
ENV NAME World

# Run php-fpm when the container launches
CMD ["php-fpm"]
