diff --git a/be/Dockerfile b/be/Dockerfile index 7365f1a..1dda81e 100644 --- a/be/Dockerfile +++ b/be/Dockerfile @@ -49,6 +49,8 @@ COPY --chown=appuser:appuser alembic/ ./alembic/ COPY --chown=appuser:appuser alembic.ini ./ COPY --chown=appuser:appuser *.py ./ COPY --chown=appuser:appuser requirements.txt ./ +COPY --chown=appuser:appuser entrypoint.sh /app/entrypoint.sh +RUN chmod +x /app/entrypoint.sh # Create logs directory RUN mkdir -p /app/logs && chown -R appuser:appuser /app @@ -64,6 +66,7 @@ HEALTHCHECK --interval=30s --timeout=10s --start-period=30s --retries=3 \ EXPOSE 8000 # Production command +ENTRYPOINT ["/app/entrypoint.sh"] CMD ["uvicorn", "app.main:app", \ "--host", "0.0.0.0", \ "--port", "8000", \ diff --git a/be/entrypoint.sh b/be/entrypoint.sh new file mode 100755 index 0000000..01d6629 --- /dev/null +++ b/be/entrypoint.sh @@ -0,0 +1,10 @@ +#!/bin/sh +set -e + +# Run database migrations +echo "Running database migrations..." +alembic upgrade head + +# Execute the command passed as arguments to this script +echo "Starting application..." +exec "$@" diff --git a/docker-compose.yml b/docker-compose.yml index 4e9ed75..88c6f5e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -33,7 +33,7 @@ services: # Pass the database URL to the backend container # Uses the service name 'db' as the host, and credentials defined above # IMPORTANT: Use the correct async driver prefix if your app needs it! - - DATABASE_URL=xxx + - DATABASE_URL=postgresql+asyncpg://mitlist_owner:npg_p0SkmyJ6BPWO@ep-small-sound-a9ketcef-pooler.gwc.azure.neon.tech/testnewmig - GEMINI_API_KEY=xxx - SECRET_KEY=xxx # Add other environment variables needed by the backend here