Fix ownership handling in app scripts

This commit is contained in:
2026-05-27 10:14:51 +02:00
parent 438c29e2e0
commit 58e646e0a0
2 changed files with 26 additions and 2 deletions
+12 -1
View File
@@ -15,6 +15,17 @@ fi
TEMPLATE_DIR="$WORKSPACE_DIR/python-fastapi-template"
TARGET_DIR="$WORKSPACE_DIR/$APP_ID"
safe_chown() {
local target="$1"
local uid
local gid
uid="${APP_UID:-$(stat -c '%u' "$WORKSPACE_DIR")}"
gid="${APP_GID:-$(stat -c '%g' "$WORKSPACE_DIR")}"
chown -R "$uid:$gid" "$target" || true
}
if [ ! -d "$TEMPLATE_DIR" ]; then
echo "Template not found: $TEMPLATE_DIR"
exit 1
@@ -99,7 +110,7 @@ git add .
git commit -m "Initial $APP_NAME"
git push -u origin main
chown -R "$APP_USER:$APP_GROUP" "$TARGET_DIR" || true
safe_chown "$TARGET_DIR"
echo ""
echo "DONE"