## Default Dockerfile
##
## @link     https://www.hyperf.io
## @document https://hyperf.wiki
## @contact  group@hyperf.io
## @license  https://github.com/hyperf/hyperf/blob/master/LICENSE
#
#FROM hyperf/hyperf:8.3-alpine-v3.19-swoole
#LABEL maintainer="Hyperf Developers <group@hyperf.io>" version="1.0" license="MIT" app.name="Hyperf"
#
###
## ---------- env settings ----------
###
## --build-arg timezone=Asia/Shanghai
#ARG timezone
#
#ENV TIMEZONE=${timezone:-"Asia/Shanghai"} \
#    APP_ENV=prod \
#    SCAN_CACHEABLE=(true)
#
## update
#RUN set -ex \
#    # show php version and extensions
#    && php -v \
#    && php -m \
#    && php --ri swoole \
#    #  ---------- some config ----------
#    && cd /etc/php* \
#    # - config PHP
#    && { \
#        echo "upload_max_filesize=128M"; \
#        echo "post_max_size=128M"; \
#        echo "memory_limit=1G"; \
#        echo "date.timezone=${TIMEZONE}"; \
#    } | tee conf.d/99_overrides.ini \
#    # - config timezone
#    && ln -sf /usr/share/zoneinfo/${TIMEZONE} /etc/localtime \
#    && echo "${TIMEZONE}" > /etc/timezone \
#    # ---------- clear works ----------
#    && rm -rf /var/cache/apk/* /tmp/* /usr/share/man \
#    && echo -e "\033[42;37m Build Completed :).\033[0m\n" \
#     && apk add --no-cache \
#            php-xdebug
#
#RUN echo "zend_extension=xdebug.so" > /etc/php83/conf.d/50_xdebug.ini \
#    && echo "xdebug.mode=debug" >> /etc/php83/conf.d/50_xdebug.ini \
#    && echo "xdebug.start_with_request=yes" >> /etc/php83/conf.d/50_xdebug.ini \
#    && echo "xdebug.client_host=192.168.31.221" >> /etc/php83/conf.d/50_xdebug.ini \
#    && echo "xdebug.client_port=9003" >> /etc/php83/conf.d/50_xdebug.ini
#
#WORKDIR /opt/www
#
## Composer Cache
## COPY ./composer.* /opt/www/
##RUN composer install --no-dev --no-scripts
#
#COPY . /opt/www
##RUN composer install --no-dev -o && php bin/hyperf.php
## RUN composer install --no-dev -o -vvv
#
#EXPOSE 9501
#
##ENTRYPOINT ["php", "/opt/www/bin/hyperf.php", "start"]
#ENTRYPOINT ["php"]


#FROM php:8.3-apache
FROM phpswoole/swoole:php8.3

RUN set -ex \
    && rm -rf /etc/apt/sources.list.d/* \
    && echo "deb http://mirrors.aliyun.com/debian/ bookworm main contrib non-free" > /etc/apt/sources.list \
    && echo "deb http://mirrors.aliyun.com/debian/ bookworm-updates main contrib non-free" >> /etc/apt/sources.list \
    && echo "deb http://mirrors.aliyun.com/debian-security bookworm-security main contrib non-free" >> /etc/apt/sources.list \
    && echo 'Acquire::Retries "3";' > /etc/apt/apt.conf.d/80-retries \
    && echo 'Acquire::http::Timeout "10";' >> /etc/apt/apt.conf.d/80-retries \
    && echo 'Acquire::https::Timeout "10";' >> /etc/apt/apt.conf.d/80-retries \
    && apt-get clean \
    && apt-get update \
    && apt-get install -y \
#       gcc g++ make autoconf libc-dev \
#       libpng-dev libjpeg-dev libfreetype6-dev \
#       libcurl4-openssl-dev \
#       libssl-dev \
#        libcares2-dev \
    libzip-dev zip unzip libpng-dev\
    && pecl install xdebug \
#    && pecl install -D 'enable-openssl="yes" enable-swoole-curl="yes" enable-cares="yes"' swoole-6.0.2 \
##    && pecl install redis \
    && docker-php-ext-install pcntl \
    && docker-php-ext-install gd \
    && docker-php-ext-install zip \
#    && docker-php-ext-enable xdebug \
    && php -v \
    && php -m \
    && php --ri swoole

# RUN #echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name 'xdebug.so')" >> /usr/local/etc/php/php.ini \
#    && echo "xdebug.mode=debug" >> /usr/local/etc/php/php.ini \
#    && echo "xdebug.start_with_request=yes" >> /usr/local/etc/php/php.ini \
#    && echo "xdebug.client_host=host.docker.internal" >> /usr/local/etc/php/php.ini \
#    && echo "xdebug.client_port=9003" >> /usr/local/etc/php/php.ini


EXPOSE 9503 9504

# docker build --no-cache --progress=plain -t xsvase:1.0 .