InfraHub
1FROM php:8.1-fpm
2
3# Install system dependencies
4RUN apt-get update && apt-get install -y \
5build-essential \
6libpng-dev \
7libonig-dev \
8libxml2-dev \
9zip \
10unzip \
11git \
12curl \
13libcurl4-openssl-dev \
14pkg-config
15
16# Install PHP extensions
17RUN docker-php-ext-install pdo_mysql mbstring exif pcntl bcmath gd
18
19# Install XML and DOM extensions
20RUN docker-php-ext-install xml
21
22# Install cURL extension
23RUN docker-php-ext-install curl
24
25# Install Composer
26COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
27
28# Set working directory
29WORKDIR /var/www/html
30
31# Copy existing application directory
32COPY . .
33
34# Install Composer dependencies
35RUN composer install --no-dev --optimize-autoloader
36
37# Generate autoload files
38RUN composer dump-autoload --optimize
39
40# Set permissions
41RUN chown -R www-data:www-data storage bootstrap/cache
42
43# Expose port 8000
44EXPOSE 8000
45
46# Start Laravel server
47CMD ["php", "artisan", "serve", "--host=0.0.0.0", "--port=8000"]
48