[fix]增加使用Dockerfile变量定义用户

This commit is contained in:
2020-09-10 09:40:19 +08:00
parent def535c123
commit 22fe2fbfce
3 changed files with 7 additions and 3 deletions
+3 -3
View File
@@ -1,9 +1,9 @@
#!/bin/bash
# shell 执行参数,分别为 -e(命令执行错误则退出脚本) -u(变量未定义则报错) -x(打印实际待执行的命令行)
set -eux
groupadd --gid 998 --system builder
useradd --gid 998 --uid 999 --shell /bin/bash --home /srv/data --system builder
groupadd --gid 998 --system ${APP_USER}
useradd --gid 998 --uid 999 --shell /bin/bash --home /srv/data --system ${APP_USER}
# 如果需要 sudo 权限,需要安装 su 软件包:apk add sudo
sed -i -e 's/^\sDefaults\s*secure_path\s*=/# Defaults secure_path=/' /etc/sudoers
echo 'builder ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
echo "${APP_USER} ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers