swoole-postgres.dockerfile 973 B

12345678910111213141516171819202122232425262728
  1. FROM php:8.0-cli
  2. RUN docker-php-ext-install opcache > /dev/null
  3. ENV SWOOLE_VERSION 4.8.0
  4. ENV SWOOLE_POSTGRES 4.8.0
  5. RUN apt-get update && apt-get install -y libpq-dev \
  6. && cd /tmp && curl -sSL "https://github.com/swoole/swoole-src/archive/v${SWOOLE_VERSION}.tar.gz" | tar xzf - \
  7. && cd swoole-src-${SWOOLE_VERSION} \
  8. && phpize && ./configure > /dev/null && make > /dev/null && make install > /dev/null \
  9. && docker-php-ext-enable swoole
  10. RUN cd /tmp && curl -sSL "https://github.com/swoole/ext-postgresql/archive/v${SWOOLE_POSTGRES}.tar.gz" | tar xzf - \
  11. && cd ext-postgresql-${SWOOLE_POSTGRES} \
  12. && phpize && ./configure > /dev/null && make > /dev/null && make install > /dev/null \
  13. && docker-php-ext-enable swoole_postgresql
  14. WORKDIR /swoole
  15. COPY swoole-server.php swoole-server.php
  16. RUN sed -i "s|_postgres||g" swoole-server.php
  17. COPY php.ini /usr/local/etc/php/
  18. EXPOSE 8080
  19. CMD php swoole-server.php