Merge pull request #19 from DDS-Derek/main
Complete the PUID and PGID settings & Optimize the image
This commit is contained in:
commit
a30a41a741
29
Dockerfile
29
Dockerfile
@ -1,5 +1,7 @@
|
|||||||
FROM python:3.10.11-slim
|
FROM python:3.10.11-slim
|
||||||
ENV LANG="C.UTF-8" \
|
ENV LANG="C.UTF-8" \
|
||||||
|
HOME="/moviepilot" \
|
||||||
|
TERM="xterm" \
|
||||||
TZ="Asia/Shanghai" \
|
TZ="Asia/Shanghai" \
|
||||||
PUID=0 \
|
PUID=0 \
|
||||||
PGID=0 \
|
PGID=0 \
|
||||||
@ -30,16 +32,33 @@ ENV LANG="C.UTF-8" \
|
|||||||
WORKDIR "/app"
|
WORKDIR "/app"
|
||||||
COPY . .
|
COPY . .
|
||||||
RUN apt-get update \
|
RUN apt-get update \
|
||||||
&& apt-get -y install musl-dev nginx gettext-base \
|
&& apt-get -y install \
|
||||||
&& mkdir -p /etc/nginx \
|
musl-dev \
|
||||||
|
nginx \
|
||||||
|
gettext-base \
|
||||||
|
locales \
|
||||||
|
procps \
|
||||||
|
gosu \
|
||||||
|
bash \
|
||||||
|
&& mkdir -p /etc/nginx ${HOME} \
|
||||||
&& cp -f nginx.conf /etc/nginx/nginx.template.conf \
|
&& cp -f nginx.conf /etc/nginx/nginx.template.conf \
|
||||||
|
&& groupadd -r moviepilot -g 911 \
|
||||||
|
&& useradd -r moviepilot -g moviepilot -d ${HOME} -s /bin/bash -u 911 \
|
||||||
|
&& pip install --upgrade pip \
|
||||||
&& pip install -r requirements.txt \
|
&& pip install -r requirements.txt \
|
||||||
|
&& playwright install-deps chromium \
|
||||||
&& python_ver=$(python3 -V | awk '{print $2}') \
|
&& python_ver=$(python3 -V | awk '{print $2}') \
|
||||||
&& echo "/app/" > /usr/local/lib/python${python_ver%.*}/site-packages/app.pth \
|
&& echo "/app/" > /usr/local/lib/python${python_ver%.*}/site-packages/app.pth \
|
||||||
&& echo 'fs.inotify.max_user_watches=5242880' >> /etc/sysctl.conf \
|
&& echo 'fs.inotify.max_user_watches=5242880' >> /etc/sysctl.conf \
|
||||||
&& echo 'fs.inotify.max_user_instances=5242880' >> /etc/sysctl.conf \
|
&& echo 'fs.inotify.max_user_instances=5242880' >> /etc/sysctl.conf \
|
||||||
&& playwright install-deps chromium \
|
&& locale-gen zh_CN.UTF-8 \
|
||||||
&& rm -rf /root/.cache/
|
&& apt-get autoremove -y \
|
||||||
|
&& apt-get clean -y \
|
||||||
|
&& rm -rf \
|
||||||
|
/tmp/* \
|
||||||
|
/moviepilot/.cache \
|
||||||
|
/var/lib/apt/lists/* \
|
||||||
|
/var/tmp/*
|
||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
VOLUME ["/config"]
|
VOLUME ["/config"]
|
||||||
ENTRYPOINT [ "bash", "-c", "/app/start.sh & nginx -g 'daemon off;'" ]
|
ENTRYPOINT [ "/app/start.sh" ]
|
||||||
|
16
start.sh
16
start.sh
@ -1,9 +1,17 @@
|
|||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
|
|
||||||
umask ${UMASK}
|
|
||||||
# 使用 `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
|
||||||
|
# 更改 moviepilot userid 和 groupid
|
||||||
|
groupmod -o -g ${PGID} moviepilot
|
||||||
|
usermod -o -u ${PUID} moviepilot
|
||||||
|
# 更改文件权限
|
||||||
|
chown -R moviepilot:moviepilot ${HOME} /app /config
|
||||||
# 下载浏览器内核
|
# 下载浏览器内核
|
||||||
playwright install chromium
|
gosu moviepilot:moviepilot playwright install chromium
|
||||||
|
# 启动前端nginx服务
|
||||||
|
nginx
|
||||||
|
# 设置后端服务权限掩码
|
||||||
|
umask ${UMASK}
|
||||||
# 启动后端服务
|
# 启动后端服务
|
||||||
python3 app/main.py
|
exec gosu moviepilot:moviepilot python3 app/main.py
|
||||||
|
Loading…
x
Reference in New Issue
Block a user