Files

16 lines
379 B
Bash
Raw Permalink Normal View History

#!/bin/sh
set -e
DATA_DIR="/app/data"
UPLOADS_DIR="/app/uploads"
mkdir -p "$DATA_DIR" "$UPLOADS_DIR"
if [ "$(id -u)" = "0" ]; then
chown -R appuser:appgroup "$DATA_DIR" "$UPLOADS_DIR"
# 基础镜像是 debian,没有 alpine 的 su-exec,用 util-linux 的 setpriv 降权
exec setpriv --reuid=appuser --regid=appgroup --clear-groups -- "$@"
else
exec "$@"
fi