-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathentrypoint.sh
More file actions
32 lines (27 loc) · 909 Bytes
/
entrypoint.sh
File metadata and controls
32 lines (27 loc) · 909 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/sh
set -e
echo "✔ Executing entrypoint script..."
IMAGE_STORAGE_PATH="/app/hold/books-sqlite3.db"
VOLUME_STORAGE_PATH="/storage/books-sqlite3.db"
echo "✔ Starting container..."
if [ ! -f "$VOLUME_STORAGE_PATH" ]; then
echo "⚠️ No existing database file found in volume."
if [ -f "$IMAGE_STORAGE_PATH" ]; then
echo "Copying database file to writable volume..."
if cp "$IMAGE_STORAGE_PATH" "$VOLUME_STORAGE_PATH"; then
echo "✔ Database initialized at $VOLUME_STORAGE_PATH"
else
echo "❌ Failed to copy database from $IMAGE_STORAGE_PATH to $VOLUME_STORAGE_PATH"
echo " Check file permissions and available disk space."
exit 1
fi
else
echo "⚠️ Database file missing at $IMAGE_STORAGE_PATH"
exit 1
fi
else
echo "✔ Existing database file found. Skipping seed copy."
fi
echo "✔ Ready!"
echo "🚀 Launching app..."
exec "$@"