feat: auto update
This commit is contained in:
parent
1c53a291fb
commit
4d626e5ed3
@ -7,6 +7,7 @@ ENV LANG="C.UTF-8" \
|
|||||||
PUID=0 \
|
PUID=0 \
|
||||||
PGID=0 \
|
PGID=0 \
|
||||||
UMASK=000 \
|
UMASK=000 \
|
||||||
|
MOVIEPILOT_AUTO_UPDATE=true \
|
||||||
NGINX_PORT=3000 \
|
NGINX_PORT=3000 \
|
||||||
CONFIG_DIR="/config" \
|
CONFIG_DIR="/config" \
|
||||||
API_TOKEN="moviepilot" \
|
API_TOKEN="moviepilot" \
|
||||||
@ -45,6 +46,8 @@ RUN apt-get update \
|
|||||||
curl \
|
curl \
|
||||||
busybox \
|
busybox \
|
||||||
&& cp -f nginx.conf /etc/nginx/nginx.template.conf \
|
&& cp -f nginx.conf /etc/nginx/nginx.template.conf \
|
||||||
|
&& cp update /usr/local/bin/mp_update \
|
||||||
|
&& chmod +x /usr/local/bin/mp_update \
|
||||||
&& mkdir -p ${HOME} \
|
&& mkdir -p ${HOME} \
|
||||||
&& groupadd -r moviepilot -g 911 \
|
&& groupadd -r moviepilot -g 911 \
|
||||||
&& useradd -r moviepilot -g moviepilot -d ${HOME} -s /bin/bash -u 911 \
|
&& useradd -r moviepilot -g moviepilot -d ${HOME} -s /bin/bash -u 911 \
|
||||||
|
6
start.sh
6
start.sh
@ -2,6 +2,12 @@
|
|||||||
|
|
||||||
# 使用 `envsubst` 将模板文件中的 ${NGINX_PORT} 替换为实际的环境变量值
|
# 使用 `envsubst` 将模板文件中的 ${NGINX_PORT} 替换为实际的环境变量值
|
||||||
envsubst '${NGINX_PORT}' < /etc/nginx/nginx.template.conf > /etc/nginx/nginx.conf
|
envsubst '${NGINX_PORT}' < /etc/nginx/nginx.template.conf > /etc/nginx/nginx.conf
|
||||||
|
# 自动更新
|
||||||
|
if [ "${MOVIEPILOT_AUTO_UPDATE}" = "true" ]; then
|
||||||
|
mp_update
|
||||||
|
else
|
||||||
|
echo "程序自动升级已关闭,如需自动升级请在创建容器时设置环境变量:MOVIEPILOT_AUTO_UPDATE=true"
|
||||||
|
fi
|
||||||
# 更改 moviepilot userid 和 groupid
|
# 更改 moviepilot userid 和 groupid
|
||||||
groupmod -o -g ${PGID} moviepilot
|
groupmod -o -g ${PGID} moviepilot
|
||||||
usermod -o -u ${PUID} moviepilot
|
usermod -o -u ${PUID} moviepilot
|
||||||
|
28
update
Normal file
28
update
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
old_version=$(cat /app/version.py)
|
||||||
|
new_version=$(curl -sL https://raw.githubusercontent.com/jxxghp/MoviePilot/main/version.py)
|
||||||
|
release_version=v$(echo ${new_version} | sed -ne "s/APP_VERSION\s=\s'v\(.*\)'/\1/gp")
|
||||||
|
|
||||||
|
if [ "${old_version}" != "${new_version}" ]; then
|
||||||
|
echo "发现新版本,开始更新程序..."
|
||||||
|
curl -sL "https://github.com/jxxghp/MoviePilot/archive/refs/tags/${release_version}.zip" | busybox unzip -d /tmp -
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
echo "后端下载成功"
|
||||||
|
curl -sL "https://github.com/jxxghp/MoviePilot-Frontend/releases/download/${release_version}/dist.zip" | busybox unzip -d /tmp -
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
echo "前端下载成功"
|
||||||
|
rm -rf /app
|
||||||
|
mv /tmp/MoviePilot* /app
|
||||||
|
rm -rf /public
|
||||||
|
mv /tmp/dist /public
|
||||||
|
echo "程序更新成功"
|
||||||
|
else
|
||||||
|
echo "前端下载失败,继续使用旧的程序来启动..."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "后端下载失败,继续使用旧的程序来启动..."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "未发现新版本,跳过更新步骤"
|
||||||
|
fi
|
Loading…
x
Reference in New Issue
Block a user