symfony-swoole.dockerfile 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. FROM php:8.2-rc-cli
  2. RUN pecl install swoole > /dev/null && \
  3. docker-php-ext-enable swoole
  4. RUN pecl install apcu > /dev/null && \
  5. docker-php-ext-enable apcu
  6. RUN apt-get update -yqq && \
  7. apt-get install -yqq libicu-dev git unzip > /dev/null && \
  8. docker-php-ext-install pdo_mysql opcache intl > /dev/null
  9. RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
  10. COPY deploy/swoole/php.ini /usr/local/etc/php/
  11. WORKDIR /symfony
  12. ADD ./composer.json /symfony/
  13. RUN mkdir -m 777 -p /symfony/var/cache/swoole /symfony/var/log
  14. RUN COMPOSER_ALLOW_SUPERUSER=1 composer install --no-dev --no-scripts
  15. # downgrade to doctrine-dbal 2.12 => due to a bug in version 2.13
  16. # see https://github.com/doctrine/dbal/issues/4603
  17. #RUN composer require doctrine/orm:2.8.5 -W
  18. #RUN composer require doctrine/dbal:2.12.x -W
  19. ADD . /symfony
  20. RUN COMPOSER_ALLOW_SUPERUSER=1 composer require "k911/swoole-bundle:^0.10" --no-scripts --with-all-dependencies
  21. RUN COMPOSER_ALLOW_SUPERUSER=1 composer dump-autoload --no-dev --classmap-authoritative
  22. RUN COMPOSER_ALLOW_SUPERUSER=1 composer dump-env swoole
  23. # removes hardcoded option `ATTR_STATEMENT_CLASS` conflicting with `ATTR_PERSISTENT`. Hack not needed when upgrading to Doctrine 3
  24. # see https://github.com/doctrine/dbal/issues/2315
  25. #RUN sed -i '/PDO::ATTR_STATEMENT_CLASS/d' ./vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php
  26. # Force debug=0 because env is not "prod"
  27. ENV APP_DEBUG=0
  28. RUN php bin/console cache:clear
  29. RUN echo "opcache.preload=/symfony/var/cache/swoole/App_KernelSwooleContainer.preload.php" >> /usr/local/etc/php/php.ini
  30. EXPOSE 8080
  31. USER www-data
  32. CMD php bin/console swoole:server:run