Files
Inventory-Manager-CC/web/server/docker-entrypoint.sh

24 lines
736 B
Bash
Executable File

#!/bin/sh
set -e
echo "[entrypoint] Starting up..."
# Ensure data directory exists and is writable by the node user
mkdir -p /data
chown -R node:node /data
echo "[entrypoint] /data permissions fixed"
# Download textures if cache is empty (first run)
TEXTURE_DIR="/data/texture-cache/minecraft"
if [ ! -d "$TEXTURE_DIR" ] || [ -z "$(ls -A "$TEXTURE_DIR" 2>/dev/null)" ]; then
echo "[entrypoint] Downloading textures (first run)..."
su-exec node node /app/download-textures.js /data/texture-cache
echo "[entrypoint] Texture download complete"
else
echo "[entrypoint] Texture cache exists, skipping download"
fi
# Drop privileges and exec the CMD
echo "[entrypoint] Dropping to user 'node', running: $*"
exec su-exec node "$@"