lumen-swoole.dockerfile 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. FROM php:7.3
  2. ENV SWOOLE_VERSION=4.3.0
  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 ./ /lumen
  9. WORKDIR /lumen
  10. COPY deploy/swoole/php.ini /usr/local/etc/php/
  11. RUN mkdir -p /lumen/storage/framework/sessions
  12. RUN mkdir -p /lumen/storage/framework/views
  13. RUN mkdir -p /lumen/storage/framework/cache
  14. RUN chmod -R 777 /lumen
  15. # Install composer using the installation method documented at https://getcomposer.org/doc/faqs/how-to-install-composer-programmatically.md
  16. # This method was chosen because composer is not part of the apt repositories that are in the default PHP 7.2 docker image
  17. # 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
  18. # 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
  19. RUN deploy/swoole/install-composer.sh
  20. RUN apt-get update -yqq > /dev/null && \
  21. apt-get install -yqq git unzip > /dev/null
  22. COPY deploy/swoole/composer* ./
  23. RUN php composer.phar install -a --no-dev --quiet
  24. RUN echo "APP_SWOOLE=true" >> .env
  25. RUN chmod -R 777 /lumen
  26. CMD php artisan swoole:http start