diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..28ee9bd --- /dev/null +++ b/.env.example @@ -0,0 +1 @@ +IPTV_ENV=dev diff --git a/.gitignore b/.gitignore index 3207dbb..1e7a74a 100644 --- a/.gitignore +++ b/.gitignore @@ -4,8 +4,7 @@ downloaded/ /src/commit /src/cache/* /src/vendor -/src/views/custom/* -!/src/views/custom/custom.twig.example +/src/views/custom.twig *.log .env *.m3u diff --git a/docker-compose.yml b/docker-compose.yml index 24054ca..da2e151 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,5 +1,3 @@ -version: '3' - networks: iptv: driver: bridge @@ -8,14 +6,19 @@ services: php: container_name: iptv-php - build: 'docker/php' + env_file: + - .env + environment: + - PHP_IDE_CONFIG=serverName=iptv.local + build: + dockerfile: docker/php/${IPTV_ENV}.dockerfile restart: unless-stopped networks: - iptv volumes: - /etc/localtime:/etc/localtime:ro - ./docker/php/www.conf:/usr/local/etc/php-fpm.d/www.conf:ro - - ./docker/php/php.ini:/usr/local/etc/php/conf.d/php.ini:ro + - ./docker/php/${IPTV_ENV}.php.ini:/usr/local/etc/php/conf.d/php.ini:ro - ./log/php:/var/log/php:rw - ./src:/var/www:rw - ./playlists.ini:/var/www/config/playlists.ini:ro diff --git a/docker/php/dockerfile b/docker/php/dev.dockerfile similarity index 50% rename from docker/php/dockerfile rename to docker/php/dev.dockerfile index 180a248..66e8bad 100644 --- a/docker/php/dockerfile +++ b/docker/php/dev.dockerfile @@ -1,16 +1,17 @@ -FROM php:8.1-fpm +FROM php:8.2-fpm RUN apt update && \ apt upgrade -y && \ - apt install -y git && \ - curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer + apt install -y git unzip 7zip # https://pecl.php.net/package/xdebug RUN pecl channel-update pecl.php.net && \ - pecl install xdebug-3.1.5 && \ + pecl install xdebug-3.3.2 unzip && \ mkdir -p /var/log/php +COPY --from=composer /usr/bin/composer /usr/local/bin/composer + EXPOSE 9000 WORKDIR /var/www CMD composer install -CMD php-fpm +ENTRYPOINT php-fpm diff --git a/docker/php/php.ini b/docker/php/dev.php.ini similarity index 56% rename from docker/php/php.ini rename to docker/php/dev.php.ini index 548dc37..e7e6b6f 100644 --- a/docker/php/php.ini +++ b/docker/php/dev.php.ini @@ -15,18 +15,10 @@ opcache.jit = tracing [xdebug] ; https://xdebug.org/docs/all_settings - -; закомментировать для выключения zend_extension = xdebug.so - -; для отладки установить значение 'develop,debug' -xdebug.mode = develop - -; для отладки при каждом запросе поменять 'trigger' на 'yes' -; иначе -- отправлять заголовок 'Cookie: XDEBUG_TRIGGER=go' -xdebug.start_with_request = trigger +xdebug.mode = debug +xdebug.start_with_request = yes xdebug.trigger_value = go - xdebug.client_host = 172.17.0.1 xdebug.REQUEST = * xdebug.SESSION = * diff --git a/docker/php/prod.dockerfile b/docker/php/prod.dockerfile new file mode 100644 index 0000000..d6e3b2a --- /dev/null +++ b/docker/php/prod.dockerfile @@ -0,0 +1,12 @@ +FROM php:8.2-fpm + +RUN apt update && \ + apt upgrade -y && \ + apt install -y git + +COPY --from=composer /usr/bin/composer /usr/local/bin/composer + +EXPOSE 9000 +WORKDIR /var/www +CMD composer install +ENTRYPOINT php-fpm diff --git a/docker/php/prod.php.ini b/docker/php/prod.php.ini new file mode 100644 index 0000000..39cde4f --- /dev/null +++ b/docker/php/prod.php.ini @@ -0,0 +1,14 @@ +[PHP] +error_reporting = E_ALL +file_uploads = Off +; upload_max_filesize=10M +; post_max_size=10M + +[opcache] +opcache.enable = 1 +opcache.enable_cli = 1 +opcache.memory_consumption = 128 +opcache.max_accelerated_files = 30000 +opcache.revalidate_freq = 0 +opcache.jit_buffer_size = 64M +opcache.jit = tracing diff --git a/src/views/custom/.gitkeep b/src/views/custom/.gitkeep deleted file mode 100644 index e69de29..0000000