fix: run Docker image as root for data volume compatibility
Revert the non-root container user so existing deployments with root-owned data volumes keep working without a manual chown step.
This commit is contained in:
1 parent
24bf6e1a81
commit
fc0cbeb4f0
3 files changed
+6
-14
No files matched your search
+1
-8
@@ -63,14 +63,7 @@ RUN apt-get update \
|
||||
&& apt-get upgrade -y --no-install-recommends \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
&& pip install --no-cache-dir -r requirements.txt \
|
||||
&& pip cache purge || true \
|
||||
&& groupadd --system --gid 1000 appuser \
|
||||
&& useradd --system --uid 1000 --gid appuser --create-home --home-dir /home/appuser --shell /usr/sbin/nologin appuser \
|
||||
&& mkdir -p /app/data \
|
||||
&& chown -R appuser:appuser /app
|
||||
|
||||
# 非 root 运行,降低容器逃逸后的主机影响面
|
||||
USER appuser
|
||||
&& pip cache purge || true
|
||||
|
||||
# 环境变量配置
|
||||
ENV HOST="0.0.0.0" \
|
||||
|
||||
Reference in new issue
Block a user