Dockerfile 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. # Default Dockerfile
  2. #
  3. # @link https://www.hyperf.io
  4. # @document https://hyperf.wiki
  5. # @contact group@hyperf.io
  6. # @license https://github.com/hyperf/hyperf/blob/master/LICENSE
  7. FROM hyperf/hyperf:8.1-alpine-v3.18-swoole
  8. LABEL maintainer="Hyperf Developers <group@hyperf.io>" version="1.0" license="MIT" app.name="Hyperf"
  9. ##
  10. # ---------- env settings ----------
  11. ##
  12. # --build-arg timezone=Asia/Shanghai
  13. ARG timezone
  14. ENV TIMEZONE=${timezone:-"Asia/Shanghai"} \
  15. APP_ENV=prod \
  16. SCAN_CACHEABLE=(true)
  17. # update
  18. RUN set -ex \
  19. # show php version and extensions
  20. && php -v \
  21. && php -m \
  22. && php --ri swoole \
  23. # ---------- some config ----------
  24. && cd /etc/php* \
  25. # - config PHP
  26. && { \
  27. echo "upload_max_filesize=128M"; \
  28. echo "post_max_size=128M"; \
  29. echo "memory_limit=1G"; \
  30. echo "date.timezone=${TIMEZONE}"; \
  31. } | tee conf.d/99_overrides.ini \
  32. # - config timezone
  33. && ln -sf /usr/share/zoneinfo/${TIMEZONE} /etc/localtime \
  34. && echo "${TIMEZONE}" > /etc/timezone \
  35. # ---------- clear works ----------
  36. && rm -rf /var/cache/apk/* /tmp/* /usr/share/man \
  37. && echo -e "\033[42;37m Build Completed :).\033[0m\n"
  38. WORKDIR /opt/www
  39. # Composer Cache
  40. # COPY ./composer.* /opt/www/
  41. # RUN composer install --no-dev --no-scripts
  42. COPY . /opt/www
  43. RUN composer install --no-dev -o && php bin/hyperf.php
  44. EXPOSE 9501
  45. ENTRYPOINT ["php", "/opt/www/bin/hyperf.php", "start"]