#!/bin/bash # ============================================================================= # backend/entrypoint.sh # ============================================================================= # Docker container entrypoint for TFM aInventory backend. # Runs first-run initialization then starts the application server. # # This script is the ENTRYPOINT defined in backend/Dockerfile. # DATA_DIR and LOGS_DIR are set via docker-compose.yml environment section. # ============================================================================= set -euo pipefail echo "🐳 [Docker] Backend container starting..." echo "🐳 [Docker] DATA_DIR=${DATA_DIR:-/app/data}" echo "🐳 [Docker] LOGS_DIR=${LOGS_DIR:-/app/logs}" # Export defaults if not already set by docker-compose export DATA_DIR="${DATA_DIR:-/app/data}" export LOGS_DIR="${LOGS_DIR:-/app/logs}" # Run shared first-run initialization echo "🐳 [Docker] Running data initialization..." bash /app/scripts/init_data.sh # Hand off to the application server echo "🐳 [Docker] Starting uvicorn..." exec python -m uvicorn backend.main:app --host 0.0.0.0 --port 8000