@@ -10,42 +10,36 @@ RUN apt-get update && apt-get install -y \
1010 zip \
1111 unzip \
1212 libssl-dev \
13- pkg-config \
14- zlib1g-dev \
15- libbrotli-dev
13+ && rm -rf /var/lib/apt/lists/*
1614
1715# Install PHP extensions
18- RUN docker-php-ext-install pdo mbstring exif pcntl bcmath gd
16+ RUN docker-php-ext-install mbstring exif pcntl bcmath gd
1917
2018# Install Redis extension
21- RUN pecl install redis \
22- && docker-php-ext-enable redis
19+ RUN pecl install redis && docker-php-ext-enable redis
2320
24- # Install Swoole extension for Octane
25- RUN pecl install swoole --enable-brotli=no --enable-openssl=no \
26- && docker-php-ext-enable swoole
21+ # Install Swoole extension
22+ RUN pecl install swoole-5.0.3 && docker-php-ext-enable swoole
2723
2824# Install Composer
29- COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
25+ COPY --from=composer:2.8.6 /usr/bin/composer /usr/bin/composer
3026
3127WORKDIR /var/www/html
3228
33- # Copy entire application first
29+ # Copy the entire application
3430COPY . .
3531
36- # Set environment variable for unattended installation
37- ENV COMPOSER_COMPILE=all
32+ # # Install dependencies including Laravel Octane
33+ # RUN composer require laravel/octane
34+ RUN composer install
3835
39- # Install dependencies
40- RUN php -d memory_limit=-1 /usr/bin/composer install --no-interaction
41-
42- # Install Octane
43- RUN php -d memory_limit=-1 /usr/bin/composer require laravel/octane --with-all-dependencies
36+ # Run Octane installation with Swoole
37+ RUN php artisan octane:install --server=swoole
4438
4539# Set proper permissions
46- RUN chown -R www-data:www-data /var/www/html
40+ RUN chown -R www-data:www-data /var/www/html/storage /var/www/html/bootstrap/cache
4741
48- # Create .env file if it doesn't exist
42+ # Create .env file from example if it doesn't exist
4943RUN if [ ! -f .env ]; then cp .env.example .env; fi
5044
5145# Generate application key only if not already set
@@ -55,4 +49,4 @@ RUN php artisan key:generate --force
5549EXPOSE 8000
5650
5751# Run Octane server
58- CMD ["php " , "artisan " , "octane:start" , " --server=swoole" , " --host=0.0.0.0" , " --port=8000" ]
52+ CMD ["sh " , "-c " , "php artisan octane:start --server=swoole --host=0.0.0.0 --port=${PORT:- 8000} " ]
0 commit comments