diff --git a/Dockerfile b/Dockerfile index ae1e08af6..5f2400da2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,10 +11,10 @@ COPY ./ /realtime_ai_character # Install Python dependencies RUN pip install -r requirements.txt -# Build the application -RUN alembic upgrade head - EXPOSE 8000 +# Make the entrypoint script executable +RUN chmod +x /realtime_ai_character/entrypoint.sh + # Run the application -CMD ["uvicorn", "realtime_ai_character.main:app", "--host", "0.0.0.0"] +CMD ["/bin/sh", "/realtime_ai_character/entrypoint.sh"] diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 000000000..261405641 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,4 @@ +#!/bin/sh +set -e +alembic upgrade head +uvicorn realtime_ai_character.main:app --host 0.0.0.0 diff --git a/realtime_ai_character/database/connection.py b/realtime_ai_character/database/connection.py index 138e01fd8..883b6d8c5 100644 --- a/realtime_ai_character/database/connection.py +++ b/realtime_ai_character/database/connection.py @@ -7,8 +7,11 @@ SQLALCHEMY_DATABASE_URL = os.getenv("DATABASE_URL") +connect_args = {"check_same_thread": False} if SQLALCHEMY_DATABASE_URL.startswith( + "sqlite") else {} + engine = create_engine( - SQLALCHEMY_DATABASE_URL, connect_args={"check_same_thread": False} + SQLALCHEMY_DATABASE_URL, connect_args=connect_args ) SessionLocal = sessionmaker( diff --git a/requirements.txt b/requirements.txt index 2974ff6ec..599234385 100644 --- a/requirements.txt +++ b/requirements.txt @@ -25,3 +25,4 @@ soundfile click google-cloud-speech anthropic +psycopg2-binary