Fix ownership handling in app scripts
This commit is contained in:
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user