dev:修改dockerfile

This commit is contained in:
liubocheng 2025-03-27 17:07:18 +08:00
parent 14b4a7a088
commit 19ce565128
1 changed files with 12 additions and 0 deletions

View File

@ -14,3 +14,15 @@ RUN apt-get update && apt-get install -y \
RUN curl -sS https://getcomposer.org/installer | php -- \
--install-dir=/usr/local/bin \
--filename=composer
# 创建非 root 用户(推荐与宿主机用户 UID/GID 一致)
ARG USER_ID=1003 # 宿主机 deploy-user 的 UID
ARG GROUP_ID=1003 # 宿主机 deploy-user 的 GID
RUN groupadd -g ${GROUP_ID} appuser \
&& useradd -u ${USER_ID} -g appuser -m -d /home/appuser -s /bin/bash appuser
# 设置工作目录权限
RUN chown -R appuser:appuser /var/www/html
# 切换到非 root 用户
USER appuser