61 lines
1.5 KiB
Docker
61 lines
1.5 KiB
Docker
FROM php:8.1-fpm
|
|
|
|
# Install system dependencies
|
|
RUN apt-get update && apt-get install -y \
|
|
git \
|
|
curl \
|
|
libpng-dev \
|
|
libonig-dev \
|
|
libxml2-dev \
|
|
libicu-dev \
|
|
zip \
|
|
unzip \
|
|
nginx \
|
|
supervisor
|
|
|
|
# Clear cache
|
|
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
|
|
|
|
# Install PHP extensions
|
|
RUN docker-php-ext-install pdo_mysql mbstring exif pcntl bcmath gd intl
|
|
|
|
# Install Redis extension
|
|
RUN pecl install redis && docker-php-ext-enable redis
|
|
|
|
# Get latest Composer
|
|
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
|
|
|
|
# Set working directory
|
|
WORKDIR /var/www
|
|
|
|
# Copy existing application directory contents
|
|
COPY . /var/www
|
|
|
|
# Install dependencies
|
|
RUN composer install --optimize-autoloader --no-dev
|
|
|
|
# Create required directories and set permissions
|
|
RUN mkdir -p /var/www/storage/framework/sessions \
|
|
/var/www/storage/framework/views \
|
|
/var/www/storage/framework/cache \
|
|
/var/www/storage/framework/testing \
|
|
/var/www/storage/logs \
|
|
/var/www/storage/app/public \
|
|
/var/www/bootstrap/cache
|
|
|
|
# Set ownership and permissions
|
|
RUN chown -R www-data:www-data /var/www
|
|
RUN chmod -R 775 /var/www/storage /var/www/bootstrap/cache
|
|
|
|
# Copy nginx configuration
|
|
COPY docker/nginx/default.conf /etc/nginx/sites-available/default
|
|
|
|
# Copy supervisor configuration
|
|
COPY docker/supervisor/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
|
|
|
# Expose port 80
|
|
EXPOSE 80
|
|
|
|
# Start supervisor
|
|
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]
|