copilot: docker optimize.
Some checks failed
Build and Push Docker Image / buildx (push) Has been cancelled
Some checks failed
Build and Push Docker Image / buildx (push) Has been cancelled
This commit is contained in:
15
scripts/entrypoint.sh
Normal file
15
scripts/entrypoint.sh
Normal file
@@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
# Ensure the data directory exists and is writable by the 'node' user.
|
||||
# This runs as root inside the container during startup, fixes ownership for
|
||||
# both named volumes and bind mounts, then drops privileges to the 'node' user.
|
||||
|
||||
DATA_DIR=/app/data
|
||||
|
||||
mkdir -p "$DATA_DIR"
|
||||
chown -R node:node "$DATA_DIR" || true
|
||||
chmod 755 "$DATA_DIR" || true
|
||||
|
||||
# Exec the requested command as the 'node' user
|
||||
exec su-exec node "$@"
|
||||
@@ -1,16 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Create data directory if it doesn't exist
|
||||
mkdir -p /app/data
|
||||
|
||||
# Try to create the database file if it doesn't exist
|
||||
touch /app/data/data.db 2>/dev/null || true
|
||||
|
||||
# Set permissions for the data directory and database file
|
||||
chmod 777 /app/data 2>/dev/null || true
|
||||
chmod 666 /app/data/data.db 2>/dev/null || true
|
||||
|
||||
echo "Data directory initialized with open permissions"
|
||||
|
||||
# Execute the main command
|
||||
exec "$@"
|
||||
Reference in New Issue
Block a user