58 lines
1.3 KiB
Docker
58 lines
1.3 KiB
Docker
# Use PHP 8.2 with Apache
|
|
FROM php:8.2-apache
|
|
|
|
# Set working directory
|
|
WORKDIR /var/www/html
|
|
|
|
# Install system dependencies
|
|
RUN apt-get update && apt-get install -y \
|
|
git \
|
|
curl \
|
|
libpng-dev \
|
|
libonig-dev \
|
|
libxml2-dev \
|
|
libzip-dev \
|
|
zip \
|
|
unzip \
|
|
nodejs \
|
|
npm \
|
|
&& docker-php-ext-install pdo_mysql mbstring exif pcntl bcmath gd zip
|
|
|
|
# Install Redis extension
|
|
RUN pecl install redis && docker-php-ext-enable redis
|
|
|
|
# Install Composer
|
|
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
|
|
|
|
# Enable Apache mod_rewrite
|
|
RUN a2enmod rewrite
|
|
|
|
# Copy Apache configuration
|
|
COPY docker/apache/000-default.conf /etc/apache2/sites-available/000-default.conf
|
|
|
|
# Copy application files
|
|
COPY . /var/www/html
|
|
|
|
# Set proper permissions
|
|
RUN chown -R www-data:www-data /var/www/html \
|
|
&& chmod -R 755 /var/www/html/storage \
|
|
&& chmod -R 755 /var/www/html/bootstrap/cache
|
|
|
|
# Install PHP dependencies
|
|
RUN composer install --no-dev --optimize-autoloader
|
|
|
|
# Install Node.js dependencies and build assets
|
|
RUN npm install && npm run build
|
|
|
|
# Create .env file if it doesn't exist
|
|
RUN if [ ! -f .env ]; then cp .env.example .env; fi
|
|
|
|
# Generate application key
|
|
RUN php artisan key:generate
|
|
|
|
# Expose port 80
|
|
EXPOSE 80
|
|
|
|
# Start Apache
|
|
CMD ["apache2-foreground"]
|