|
|
|
|
|
|
| FROM python:3.13-slim
|
|
|
|
|
| RUN useradd -m -u 1000 user
|
|
|
|
|
| USER user
|
|
|
|
|
| ENV PATH="/home/user/.local/bin:$PATH"
|
|
|
|
|
| WORKDIR /app
|
|
|
|
|
| COPY --chown=user ./requirements.txt requirements.txt
|
|
|
|
|
| RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
|
|
|
|
| RUN echo "DATABASE_URL=postgresql+asyncpg://neondb_owner:npg_Ulao9GqPOr0F@ep-empty-forest-adwdbz6a-pooler.c-2.us-east-1.aws.neon.tech/neondb" > .env
|
|
|
|
|
| COPY --chown=user . /app
|
|
|
|
|
| RUN chmod +x /app/startup.sh
|
|
|
|
|
| RUN python create_tables.py
|
|
|
|
|
| ENV DATABASE_URL=postgresql+asyncpg://neondb_owner:npg_Ulao9GqPOr0F@ep-empty-forest-adwdbz6a-pooler.c-2.us-east-1.aws.neon.tech/neondb
|
|
|
|
|
| EXPOSE 7860 8000
|
|
|
|
|
| CMD ["sh", "-c", "echo 'π Starting Hackathon Todo Backend...' && echo 'π¦ Running database migrations...' && python -m alembic upgrade head || echo 'β οΈ Database migrations completed with warnings (this is often expected)' && echo 'β
Database migrations completed' && echo 'π Starting MCP server on port 8000...' && python src/mcp_server.py & sleep 5 && echo 'π Starting FastAPI application on port 7860...' && exec uvicorn app.main:app --host 0.0.0.0 --port 7860"] |