diff --git a/app/Module/Apps/Apps.php b/app/Module/Apps/Apps.php index 374841c66..37c6cea41 100644 --- a/app/Module/Apps/Apps.php +++ b/app/Module/Apps/Apps.php @@ -135,7 +135,7 @@ class Apps // 执行docker-compose命令 $curlPath = "app/{$command}/{$appName}"; if ($command === 'up') { - $curlPath .= "?callback_url=" . urlencode("http://host.docker.internal:" . env("APP_PORT") . "/api/apps/install/callback?install_num=" . $updateConfig[$prefix . '_num']); + $curlPath .= "?callback_url=" . urlencode("http://nginx/api/apps/install/callback?install_num=" . $updateConfig[$prefix . '_num']); } $res = self::curl($curlPath); if (Base::isError($res)) { @@ -821,7 +821,7 @@ class Apps */ private static function curl($path): array { - $url = "http://nginx/appstore/api/{$path}"; + $url = "http://appstore/api/{$path}"; $extra = [ 'Content-Type' => 'application/json', 'Authorization' => 'Bearer ' . md5(env('APP_KEY')), diff --git a/cmd b/cmd index f6df9cb29..9955142e2 100755 --- a/cmd +++ b/cmd @@ -56,7 +56,7 @@ rand_string() { if [[ `uname` == 'Linux' ]]; then echo "$(date +%s%N | md5sum | cut -c 1-${lan})" else - echo "$(docker run -it --rm alpine sh -c "date +%s%N | md5sum | cut -c 1-${lan}")" + echo "$(docker run -it --rm nginx:alpine sh -c "date +%s%N | md5sum | cut -c 1-${lan}")" fi } @@ -238,7 +238,7 @@ remove_by_network() { } uninstall_appstore() { - docker run -it --rm -v ${cur_path}/docker/appstore:/appstore alpine sh -c "find /appstore/configs -mindepth 1 -type d | sort -r | xargs rm -rf; rm -f /appstore/logs/*.log" + docker run -it --rm -v ${cur_path}/docker/appstore:/appstore nginx:alpine sh -c "find /appstore/configs -mindepth 1 -type d | sort -r | xargs rm -rf; rm -f /appstore/logs/*.log" } https_auto() { @@ -311,7 +311,7 @@ env_set() { if [[ `uname` == 'Linux' ]]; then sed -i "/^${key}=/c\\${key}=${val}" ${cur_path}/.env else - docker run -it --rm -v ${cur_path}:/www alpine sh -c "sed -i "/^${key}=/c\\${key}=${val}" /www/.env" + docker run -it --rm -v ${cur_path}:/www nginx:alpine sh -c "sed -i "/^${key}=/c\\${key}=${val}" /www/.env" fi if [ $? -ne 0 ]; then error "设置env参数失败!" diff --git a/composer.json b/composer.json index 396557f96..a9159cb3a 100644 --- a/composer.json +++ b/composer.json @@ -11,6 +11,7 @@ "php": "^8.0", "ext-curl": "*", "ext-dom": "*", + "ext-ffi": "*", "ext-fileinfo": "*", "ext-gd": "*", "ext-imagick": "*", diff --git a/docker-compose.yml b/docker-compose.yml index 0684f814b..418c94e8a 100755 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,7 +1,7 @@ services: php: container_name: "dootask-php-${APP_ID}" - image: "kuaifan/php:swoole-8.0.rc18" + image: "kuaifan/php:swoole-8.0.rc20" shm_size: 2G ulimits: core: @@ -210,12 +210,14 @@ services: privileged: true image: "kuaifan/dootask-appstore:0.0.2" volumes: + - shared_data:/usr/share/dootask - /var/run/docker.sock:/var/run/docker.sock - ./:/var/www environment: DOO_ENV: "/var/www" HOST_PWD: "${PWD}" - network_mode: host + networks: + - extnetwork restart: unless-stopped networks: diff --git a/docker/nginx/location/appstore.conf b/docker/nginx/location/appstore.conf new file mode 100755 index 000000000..c2b66aa8e --- /dev/null +++ b/docker/nginx/location/appstore.conf @@ -0,0 +1,17 @@ +location /appstore/ { + proxy_http_version 1.1; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Real-PORT $remote_port; + proxy_set_header X-Forwarded-Host $the_host/appstore; + proxy_set_header X-Forwarded-Proto $the_scheme; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header Host $http_host; + proxy_set_header Scheme $scheme; + proxy_set_header Server-Protocol $server_protocol; + proxy_set_header Server-Name $server_name; + proxy_set_header Server-Addr $server_addr; + proxy_set_header Server-Port $server_port; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection $connection_upgrade; + proxy_pass http://appstore/; +}