small fixes
Some checks failed
Build and Push Shulker Image / build (push) Failing after 12s

This commit is contained in:
Marc
2025-10-02 10:35:24 +02:00
parent 3829e3d409
commit 4f13a498a2
3 changed files with 20 additions and 4 deletions

View File

@@ -1,6 +1,13 @@
#!/bin/sh
set -e
# Ensure runtime dirs exist and are writable for the app user when running as root
if [ "$(id -u)" = "0" ]; then
mkdir -p /data /minecraft/logs || true
# 10001 is the shulker user created in the image
chown -R 10001:10001 /data /minecraft || true
fi
# If no config exists in /data, seed it from the example and apply env overrides if provided
if [ ! -f /data/config.json ]; then
echo "Seeding /data/config.json from example"
@@ -67,4 +74,11 @@ jq ".IS_LOCAL_FILE=${IS_LOCAL_FILE} | .LOCAL_FILE_PATH=\"${LOCAL_FILE_PATH}\"" /
# Link config into app directory where shulker expects it
ln -sf /data/config.json /app/config.json
exec "$@"
# If running as root, drop privileges to shulker before starting the app
if [ "$(id -u)" = "0" ]; then
# Ensure ownership after seeding as root
chown -R 10001:10001 /data || true
exec su-exec 10001:10001 "$@"
else
exec "$@"
fi