Skip to content

Commit 2a61720

Browse files
authored
Merge pull request #1052 from DDS-Derek/main
2 parents c9d461f + 7348464 commit 2a61720

File tree

4 files changed

+44
-47
lines changed

4 files changed

+44
-47
lines changed

Dockerfile

+6-8
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ ENV LANG="C.UTF-8" \
1111
PORT=3001 \
1212
NGINX_PORT=3000 \
1313
PROXY_HOST="" \
14-
MOVIEPILOT_AUTO_UPDATE=true \
15-
MOVIEPILOT_AUTO_UPDATE_DEV=false \
14+
MOVIEPILOT_AUTO_UPDATE=release \
1615
AUTH_SITE="iyuu" \
1716
IYUU_SIGN=""
1817
WORKDIR "/app"
@@ -78,12 +77,11 @@ RUN cp -f /app/nginx.conf /etc/nginx/nginx.template.conf \
7877
&& FRONTEND_VERSION=$(curl -sL "https://api.github.com/repos/jxxghp/MoviePilot-Frontend/releases/latest" | jq -r .tag_name) \
7978
&& curl -sL "https://github.com/jxxghp/MoviePilot-Frontend/releases/download/${FRONTEND_VERSION}/dist.zip" | busybox unzip -d / - \
8079
&& mv /dist /public \
81-
&& curl -sL "https://github.com/jxxghp/MoviePilot-Plugins/archive/refs/heads/main.zip" | busybox unzip -d / - \
82-
&& mv -f /MoviePilot-Plugins-main/plugins/* /app/app/plugins/ \
83-
&& rm -rf /MoviePilot-Plugins-main \
84-
&& curl -sL "https://github.com/jxxghp/MoviePilot-Resources/archive/refs/heads/main.zip" | busybox unzip -d / - \
85-
&& mv -f /MoviePilot-Resources-main/resources/* /app/app/helper/ \
86-
&& rm -rf /MoviePilot-Resources-main
80+
&& curl -sL "https://github.com/jxxghp/MoviePilot-Plugins/archive/refs/heads/main.zip" | busybox unzip -d /tmp - \
81+
&& mv -f /tmp/MoviePilot-Plugins-main/plugins/* /app/app/plugins/ \
82+
&& curl -sL "https://github.com/jxxghp/MoviePilot-Resources/archive/refs/heads/main.zip" | busybox unzip -d /tmp - \
83+
&& mv -f /tmp/MoviePilot-Resources-main/resources/* /app/app/helper/ \
84+
&& rm -rf /tmp/*
8785
EXPOSE 3000
8886
VOLUME [ "/config" ]
8987
ENTRYPOINT [ "/entrypoint" ]

README.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,7 @@ MoviePilot需要配套下载器和媒体服务器配合使用。
7070
- **PGID**:运行程序用户的`gid`,默认`0`(仅支持环境变量配置)
7171
- **UMASK**:掩码权限,默认`000`,可以考虑设置为`022`(仅支持环境变量配置)
7272
- **PROXY_HOST:** 网络代理,访问themoviedb或者重启更新需要使用代理访问,格式为`http(s)://ip:port``socks5://user:pass@host:port`(仅支持环境变量配置)
73-
- **MOVIEPILOT_AUTO_UPDATE**:重启更新,`true`/`false`,默认`true` **注意:如果出现网络问题可以配置`PROXY_HOST`**(仅支持环境变量配置)
74-
- **MOVIEPILOT_AUTO_UPDATE_DEV**:重启时更新到未发布的开发版本代码,`true`/`false`,默认`false`(仅支持环境变量配置)
73+
- **MOVIEPILOT_AUTO_UPDATE**:重启更新,`true`/`release`/`dev`/`false`,默认`release` **注意:如果出现网络问题可以配置`PROXY_HOST`**(仅支持环境变量配置)
7574
---
7675
- **❗SUPERUSER:** 超级管理员用户名,默认`admin`,安装后使用该用户登录后台管理界面
7776
- **❗SUPERUSER_PASSWORD:** 超级管理员初始密码,默认`password`,建议修改为复杂密码

entrypoint

+3-7
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,9 @@
33
# 使用 `envsubst` 将模板文件中的 ${NGINX_PORT} 替换为实际的环境变量值
44
envsubst '${NGINX_PORT}${PORT}' < /etc/nginx/nginx.template.conf > /etc/nginx/nginx.conf
55
# 自动更新
6-
if [ "${MOVIEPILOT_AUTO_UPDATE}" = "true" ]; then
7-
cd /
8-
/usr/local/bin/mp_update
9-
cd /app
10-
else
11-
echo "程序自动升级已关闭,如需自动升级请在创建容器时设置环境变量:MOVIEPILOT_AUTO_UPDATE=true"
12-
fi
6+
cd /
7+
/usr/local/bin/mp_update
8+
cd /app
139
# 更改 moviepilot userid 和 groupid
1410
groupmod -o -g ${PGID} moviepilot
1511
usermod -o -u ${PUID} moviepilot

update

+34-30
Original file line numberDiff line numberDiff line change
@@ -74,39 +74,43 @@ install_backend_and_download_resources() {
7474
fi
7575
}
7676

77-
# ...
78-
79-
if [ -n "${PROXY_HOST}" ]; then
80-
CURL_OPTIONS="-sL -x ${PROXY_HOST}"
81-
PIP_OPTIONS="--proxy=${PROXY_HOST}"
82-
echo "使用代理更新程序"
83-
else
84-
CURL_OPTIONS="-sL"
85-
echo "不使用代理更新程序"
86-
fi
87-
88-
if [ "${MOVIEPILOT_AUTO_UPDATE_DEV}" = "true" ]; then
89-
echo "Dev 更新模式"
90-
install_backend_and_download_resources "heads/main.zip"
91-
else
92-
old_version=$(cat /app/version.py)
93-
if [[ "${old_version}" == *APP_VERSION* ]]; then
94-
current_version=v$(echo ${old_version} | sed -ne "s/APP_VERSION\s=\s'v\(.*\)'/\1/gp")
95-
echo "当前版本号:${current_version}"
96-
new_version=$(curl ${CURL_OPTIONS} "https://api.github.com/repos/jxxghp/MoviePilot/releases/latest" | jq -r .tag_name)
97-
if [[ "${new_version}" == *v* ]]; then
98-
release_version=${new_version}
99-
echo "最新版本号:${release_version}"
100-
if [ "${current_version}" != "${release_version}" ]; then
101-
echo "发现新版本,开始自动升级..."
102-
install_backend_and_download_resources "tags/${release_version}.zip"
77+
if [[ "${MOVIEPILOT_AUTO_UPDATE}" = "true" ]] || [[ "${MOVIEPILOT_AUTO_UPDATE}" = "release" ]] || elif [[ "${MOVIEPILOT_AUTO_UPDATE}" = "dev" ]]; then
78+
if [ -n "${PROXY_HOST}" ]; then
79+
CURL_OPTIONS="-sL -x ${PROXY_HOST}"
80+
PIP_OPTIONS="--proxy=${PROXY_HOST}"
81+
echo "使用代理更新程序"
82+
else
83+
CURL_OPTIONS="-sL"
84+
echo "不使用代理更新程序"
85+
fi
86+
if [ "${MOVIEPILOT_AUTO_UPDATE}" = "dev" ]; then
87+
echo "Dev 更新模式"
88+
install_backend_and_download_resources "heads/main.zip"
89+
else
90+
echo "Release 更新模式"
91+
old_version=$(cat /app/version.py)
92+
if [[ "${old_version}" == *APP_VERSION* ]]; then
93+
current_version=v$(echo ${old_version} | sed -ne "s/APP_VERSION\s=\s'v\(.*\)'/\1/gp")
94+
echo "当前版本号:${current_version}"
95+
new_version=$(curl ${CURL_OPTIONS} "https://api.github.com/repos/jxxghp/MoviePilot/releases/latest" | jq -r .tag_name)
96+
if [[ "${new_version}" == *v* ]]; then
97+
release_version=${new_version}
98+
echo "最新版本号:${release_version}"
99+
if [ "${current_version}" != "${release_version}" ]; then
100+
echo "发现新版本,开始自动升级..."
101+
install_backend_and_download_resources "tags/${release_version}.zip"
102+
else
103+
echo "未发现新版本,跳过更新步骤..."
104+
fi
103105
else
104-
echo "未发现新版本,跳过更新步骤..."
106+
echo "最新版本号获取失败,继续启动..."
105107
fi
106108
else
107-
echo "最新版本号获取失败,继续启动..."
109+
echo "当前版本号获取失败,继续启动..."
108110
fi
109-
else
110-
echo "当前版本号获取失败,继续启动..."
111111
fi
112+
elif [[ "${MOVIEPILOT_AUTO_UPDATE}" = "false" ]]; then
113+
echo "程序自动升级已关闭,如需自动升级请在创建容器时设置环境变量:MOVIEPILOT_AUTO_UPDATE=release"
114+
else
115+
echo "MOVIEPILOT_AUTO_UPDATE 变量设置错误"
112116
fi

0 commit comments

Comments
 (0)