laravel-swoole.dockerfile 1.3 KB

123456789101112131415161718192021222324252627282930313233343536
  1. FROM php:7.4
  2. RUN pecl install swoole > /dev/null && \
  3. docker-php-ext-enable swoole
  4. RUN docker-php-ext-install pdo_mysql > /dev/null
  5. ADD ./ /laravel
  6. WORKDIR /laravel
  7. COPY deploy/swoole/php.ini /usr/local/etc/php/
  8. RUN mkdir -p /laravel/bootstrap/cache
  9. RUN mkdir -p /laravel/storage/framework/sessions
  10. RUN mkdir -p /laravel/storage/framework/views
  11. RUN mkdir -p /laravel/storage/framework/cache
  12. RUN chmod -R 777 /laravel
  13. RUN echo "APP_SWOOLE=true" >> .env
  14. # Install composer using the installation method documented at https://getcomposer.org/doc/faqs/how-to-install-composer-programmatically.md
  15. # This method was chosen because composer is not part of the apt repositories that are in the default PHP 7.4 docker image
  16. # Adding alternate apt php repos can potentially cause problems with extension compatibility between the php build from the docker image and the alternate php build
  17. # An additional benefit of this method is that the correct version of composer will be used for the environment and version of the php system in the docker image
  18. RUN deploy/swoole/install-composer.sh
  19. RUN apt-get update -yqq > /dev/null && \
  20. apt-get install -yqq git unzip > /dev/null
  21. COPY deploy/swoole/composer* ./
  22. RUN php composer.phar install -a --no-dev --quiet
  23. RUN php artisan optimize
  24. RUN chmod -R 777 /laravel
  25. CMD php artisan swoole:http start