
# Set the base image to use for the container
FROM php:8.2-cli

# Install system dependencies and PHP extensions required for Laravel with PostgreSQL
RUN apt-get update && apt-get install -y \
    libpng-dev \
    libjpeg62-turbo-dev \
    libfreetype6-dev \
    zip \
    git \
    unzip \
    libxml2-dev \
    libpq-dev \
    && docker-php-ext-configure gd --with-freetype --with-jpeg \
    && docker-php-ext-install gd pdo pdo_pgsql pgsql xml

# Install Composer globally
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer

# Set working directory inside the container
WORKDIR /var/www

# Copy the existing Laravel application code to the container
COPY . .

# Install Laravel's dependencies via Composer
RUN composer install --no-dev --optimize-autoloader

# Expose the default port 8000
EXPOSE 8000

# Command to run the Laravel development server
CMD ["php", "artisan", "serve", "--host=0.0.0.0", "--port=8000"]

