laravel-swoole.dockerfile 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. FROM php:7.2
  2. ENV SWOOLE_VERSION=4.2.1
  3. RUN cd /tmp && curl -sSL "https://github.com/swoole/swoole-src/archive/v${SWOOLE_VERSION}.tar.gz" | tar xzf - \
  4. && cd swoole-src-${SWOOLE_VERSION} \
  5. && phpize && ./configure > /dev/null && make > /dev/null && make install > /dev/null \
  6. && docker-php-ext-enable swoole
  7. RUN docker-php-ext-install pdo_mysql > /dev/null
  8. ADD ./ /laravel
  9. WORKDIR /laravel
  10. COPY deploy/swoole/php.ini /usr/local/etc/php/
  11. RUN mkdir -p /laravel/bootstrap/cache
  12. RUN mkdir -p /laravel/storage/framework/sessions
  13. RUN mkdir -p /laravel/storage/framework/views
  14. RUN mkdir -p /laravel/storage/framework/cache
  15. RUN chmod -R 777 /laravel
  16. RUN echo "APP_SWOOLE=true" >> .env
  17. # Install composer using the installation method documented at https://getcomposer.org/doc/faqs/how-to-install-composer-programmatically.md
  18. # This method was chosen because composer is not part of the apt repositories that are in the default PHP 7.2 docker image
  19. # 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
  20. # 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
  21. RUN deploy/swoole/install-composer.sh
  22. RUN apt-get update -yqq > /dev/null && \
  23. apt-get install -yqq git unzip > /dev/null
  24. COPY deploy/swoole/composer* ./
  25. RUN php composer.phar install -a --no-dev --quiet
  26. RUN php artisan config:cache
  27. RUN php artisan route:cache
  28. RUN chmod -R 777 /laravel
  29. CMD php artisan swoole:http start