diff --git a/Dockerfile b/Dockerfile index 165ab370..631532e7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,8 +11,7 @@ ENV LANG="C.UTF-8" \ PORT=3001 \ NGINX_PORT=3000 \ PROXY_HOST="" \ - MOVIEPILOT_AUTO_UPDATE=true \ - MOVIEPILOT_AUTO_UPDATE_DEV=false \ + MOVIEPILOT_AUTO_UPDATE=release \ AUTH_SITE="iyuu" \ IYUU_SIGN="" WORKDIR "/app" @@ -78,12 +77,11 @@ RUN cp -f /app/nginx.conf /etc/nginx/nginx.template.conf \ && FRONTEND_VERSION=$(curl -sL "https://api.github.com/repos/jxxghp/MoviePilot-Frontend/releases/latest" | jq -r .tag_name) \ && curl -sL "https://github.com/jxxghp/MoviePilot-Frontend/releases/download/${FRONTEND_VERSION}/dist.zip" | busybox unzip -d / - \ && mv /dist /public \ - && curl -sL "https://github.com/jxxghp/MoviePilot-Plugins/archive/refs/heads/main.zip" | busybox unzip -d / - \ - && mv -f /MoviePilot-Plugins-main/plugins/* /app/app/plugins/ \ - && rm -rf /MoviePilot-Plugins-main \ - && curl -sL "https://github.com/jxxghp/MoviePilot-Resources/archive/refs/heads/main.zip" | busybox unzip -d / - \ - && mv -f /MoviePilot-Resources-main/resources/* /app/app/helper/ \ - && rm -rf /MoviePilot-Resources-main + && curl -sL "https://github.com/jxxghp/MoviePilot-Plugins/archive/refs/heads/main.zip" | busybox unzip -d /tmp - \ + && mv -f /tmp/MoviePilot-Plugins-main/plugins/* /app/app/plugins/ \ + && curl -sL "https://github.com/jxxghp/MoviePilot-Resources/archive/refs/heads/main.zip" | busybox unzip -d /tmp - \ + && mv -f /tmp/MoviePilot-Resources-main/resources/* /app/app/helper/ \ + && rm -rf /tmp/* EXPOSE 3000 VOLUME [ "/config" ] ENTRYPOINT [ "/entrypoint" ] diff --git a/README.md b/README.md index f5f0a33b..c43b6043 100644 --- a/README.md +++ b/README.md @@ -70,8 +70,7 @@ MoviePilot需要配套下载器和媒体服务器配合使用。 - **PGID**:运行程序用户的`gid`,默认`0`(仅支持环境变量配置) - **UMASK**:掩码权限,默认`000`,可以考虑设置为`022`(仅支持环境变量配置) - **PROXY_HOST:** 网络代理,访问themoviedb或者重启更新需要使用代理访问,格式为`http(s)://ip:port`、`socks5://user:pass@host:port`(仅支持环境变量配置) -- **MOVIEPILOT_AUTO_UPDATE**:重启更新,`true`/`false`,默认`true` **注意:如果出现网络问题可以配置`PROXY_HOST`**(仅支持环境变量配置) -- **MOVIEPILOT_AUTO_UPDATE_DEV**:重启时更新到未发布的开发版本代码,`true`/`false`,默认`false`(仅支持环境变量配置) +- **MOVIEPILOT_AUTO_UPDATE**:重启更新,`true`/`release`/`dev`/`false`,默认`release` **注意:如果出现网络问题可以配置`PROXY_HOST`**(仅支持环境变量配置) --- - **❗SUPERUSER:** 超级管理员用户名,默认`admin`,安装后使用该用户登录后台管理界面 - **❗SUPERUSER_PASSWORD:** 超级管理员初始密码,默认`password`,建议修改为复杂密码 diff --git a/entrypoint b/entrypoint index 135f8aab..7a0c3072 100644 --- a/entrypoint +++ b/entrypoint @@ -3,13 +3,9 @@ # 使用 `envsubst` 将模板文件中的 ${NGINX_PORT} 替换为实际的环境变量值 envsubst '${NGINX_PORT}${PORT}' < /etc/nginx/nginx.template.conf > /etc/nginx/nginx.conf # 自动更新 -if [ "${MOVIEPILOT_AUTO_UPDATE}" = "true" ]; then - cd / - /usr/local/bin/mp_update - cd /app -else - echo "程序自动升级已关闭,如需自动升级请在创建容器时设置环境变量:MOVIEPILOT_AUTO_UPDATE=true" -fi +cd / +/usr/local/bin/mp_update +cd /app # 更改 moviepilot userid 和 groupid groupmod -o -g ${PGID} moviepilot usermod -o -u ${PUID} moviepilot diff --git a/update b/update index 0de1fb69..a9f00400 100644 --- a/update +++ b/update @@ -74,39 +74,43 @@ install_backend_and_download_resources() { fi } -# ... - -if [ -n "${PROXY_HOST}" ]; then - CURL_OPTIONS="-sL -x ${PROXY_HOST}" - PIP_OPTIONS="--proxy=${PROXY_HOST}" - echo "使用代理更新程序" -else - CURL_OPTIONS="-sL" - echo "不使用代理更新程序" -fi - -if [ "${MOVIEPILOT_AUTO_UPDATE_DEV}" = "true" ]; then - echo "Dev 更新模式" - install_backend_and_download_resources "heads/main.zip" -else - old_version=$(cat /app/version.py) - if [[ "${old_version}" == *APP_VERSION* ]]; then - current_version=v$(echo ${old_version} | sed -ne "s/APP_VERSION\s=\s'v\(.*\)'/\1/gp") - echo "当前版本号:${current_version}" - new_version=$(curl ${CURL_OPTIONS} "https://api.github.com/repos/jxxghp/MoviePilot/releases/latest" | jq -r .tag_name) - if [[ "${new_version}" == *v* ]]; then - release_version=${new_version} - echo "最新版本号:${release_version}" - if [ "${current_version}" != "${release_version}" ]; then - echo "发现新版本,开始自动升级..." - install_backend_and_download_resources "tags/${release_version}.zip" +if [[ "${MOVIEPILOT_AUTO_UPDATE}" = "true" ]] || [[ "${MOVIEPILOT_AUTO_UPDATE}" = "release" ]] || elif [[ "${MOVIEPILOT_AUTO_UPDATE}" = "dev" ]]; then + if [ -n "${PROXY_HOST}" ]; then + CURL_OPTIONS="-sL -x ${PROXY_HOST}" + PIP_OPTIONS="--proxy=${PROXY_HOST}" + echo "使用代理更新程序" + else + CURL_OPTIONS="-sL" + echo "不使用代理更新程序" + fi + if [ "${MOVIEPILOT_AUTO_UPDATE}" = "dev" ]; then + echo "Dev 更新模式" + install_backend_and_download_resources "heads/main.zip" + else + echo "Release 更新模式" + old_version=$(cat /app/version.py) + if [[ "${old_version}" == *APP_VERSION* ]]; then + current_version=v$(echo ${old_version} | sed -ne "s/APP_VERSION\s=\s'v\(.*\)'/\1/gp") + echo "当前版本号:${current_version}" + new_version=$(curl ${CURL_OPTIONS} "https://api.github.com/repos/jxxghp/MoviePilot/releases/latest" | jq -r .tag_name) + if [[ "${new_version}" == *v* ]]; then + release_version=${new_version} + echo "最新版本号:${release_version}" + if [ "${current_version}" != "${release_version}" ]; then + echo "发现新版本,开始自动升级..." + install_backend_and_download_resources "tags/${release_version}.zip" + else + echo "未发现新版本,跳过更新步骤..." + fi else - echo "未发现新版本,跳过更新步骤..." + echo "最新版本号获取失败,继续启动..." fi else - echo "最新版本号获取失败,继续启动..." + echo "当前版本号获取失败,继续启动..." fi - else - echo "当前版本号获取失败,继续启动..." fi +elif [[ "${MOVIEPILOT_AUTO_UPDATE}" = "false" ]]; then + echo "程序自动升级已关闭,如需自动升级请在创建容器时设置环境变量:MOVIEPILOT_AUTO_UPDATE=release" +else + echo "MOVIEPILOT_AUTO_UPDATE 变量设置错误" fi \ No newline at end of file