Skip to content

Commit 0643be7

Browse files
nanotaboadaclaude
andcommitted
chore(docker): simplify entrypoint — use log helper, remove seed copy (#130)
Flyway now handles database initialization, so the seed copy logic is no longer needed. Align with the Rust entrypoint style: use a log() helper for formatted output, add Swagger UI endpoint to the startup banner, keep health check endpoint. Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent d34b063 commit 0643be7

1 file changed

Lines changed: 18 additions & 27 deletions

File tree

scripts/entrypoint.sh

Lines changed: 18 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,28 @@
11
#!/bin/sh
22
set -e
33

4-
echo "✔ Executing entrypoint script..."
4+
# Helper function for formatted logging
5+
log() {
6+
echo "[ENTRYPOINT] $(date '+%Y/%m/%d - %H:%M:%S') | $1"
7+
return 0
8+
}
59

6-
IMAGE_STORAGE_PATH="/app/hold/players-sqlite3.db"
7-
VOLUME_STORAGE_PATH="/storage/players-sqlite3.db"
10+
log "✔ Starting container..."
811

9-
echo "✔ Starting container..."
12+
STORAGE_PATH="${STORAGE_PATH:-storage/players-sqlite3.db}"
1013

11-
if [ ! -f "$VOLUME_STORAGE_PATH" ]; then
12-
echo "⚠️ No existing database file found in volume."
13-
if [ -f "$IMAGE_STORAGE_PATH" ]; then
14-
echo "Copying database file to writable volume..."
15-
if cp "$IMAGE_STORAGE_PATH" "$VOLUME_STORAGE_PATH"; then
16-
echo "✔ Database initialized at $VOLUME_STORAGE_PATH"
17-
else
18-
echo "❌ Failed to copy database from $IMAGE_STORAGE_PATH to $VOLUME_STORAGE_PATH"
19-
echo " Check file permissions and available disk space."
20-
exit 1
21-
fi
22-
else
23-
echo "⚠️ Database file missing at $IMAGE_STORAGE_PATH"
24-
exit 1
25-
fi
14+
mkdir -p "$(dirname "$STORAGE_PATH")"
15+
16+
if [ ! -f "$STORAGE_PATH" ]; then
17+
log "⚠️ No existing database file found at $STORAGE_PATH."
18+
log "🗄️ Flyway migrations will initialize the database on first start."
2619
else
27-
echo "✔ Existing database file found. Skipping seed copy."
20+
log "✔ Existing database file found at $STORAGE_PATH."
2821
fi
2922

30-
echo "✔ Ready!"
31-
echo "🚀 Launching app..."
32-
echo ""
33-
echo "🔌 Endpoints:"
34-
echo " Health: http://localhost:9001/actuator/health"
35-
echo " Players: http://localhost:9000/players"
36-
echo ""
23+
log "✔ Ready!"
24+
log "🚀 Launching app..."
25+
log "🔌 API endpoints | http://localhost:9000"
26+
log "📚 Swagger UI | http://localhost:9000/swagger/index.html"
27+
log "❤️ Health check | http://localhost:9001/actuator/health"
3728
exec "$@"

0 commit comments

Comments
 (0)