Spaces:
Sleeping
Sleeping
Commit
·
68e3bd8
1
Parent(s):
6c42dc2
remove docker
Browse files- .dockerignore +0 -51
- Dockerfile +0 -104
.dockerignore
DELETED
|
@@ -1,51 +0,0 @@
|
|
| 1 |
-
# Virtual environment
|
| 2 |
-
venv/
|
| 3 |
-
env/
|
| 4 |
-
.venv/
|
| 5 |
-
|
| 6 |
-
# Python cache
|
| 7 |
-
__pycache__/
|
| 8 |
-
*.py[cod]
|
| 9 |
-
*$py.class
|
| 10 |
-
*.so
|
| 11 |
-
.Python
|
| 12 |
-
|
| 13 |
-
# Environment files with secrets
|
| 14 |
-
.env
|
| 15 |
-
.env.local
|
| 16 |
-
.env.*.local
|
| 17 |
-
|
| 18 |
-
# IDE files
|
| 19 |
-
.vscode/
|
| 20 |
-
.idea/
|
| 21 |
-
*.swp
|
| 22 |
-
*.swo
|
| 23 |
-
*~
|
| 24 |
-
|
| 25 |
-
# OS files
|
| 26 |
-
.DS_Store
|
| 27 |
-
Thumbs.db
|
| 28 |
-
|
| 29 |
-
# Git
|
| 30 |
-
.git/
|
| 31 |
-
.gitignore
|
| 32 |
-
|
| 33 |
-
# Documentation (optional - include if you want)
|
| 34 |
-
# *.md
|
| 35 |
-
# docs/
|
| 36 |
-
|
| 37 |
-
# Test files (optional)
|
| 38 |
-
# tests/
|
| 39 |
-
# test_*.py
|
| 40 |
-
|
| 41 |
-
# Logs
|
| 42 |
-
*.log
|
| 43 |
-
logs/
|
| 44 |
-
|
| 45 |
-
# Database files (avoid copying local dev databases into images)
|
| 46 |
-
data/*.db
|
| 47 |
-
|
| 48 |
-
# Temporary files
|
| 49 |
-
*.tmp
|
| 50 |
-
*.temp
|
| 51 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Dockerfile
DELETED
|
@@ -1,104 +0,0 @@
|
|
| 1 |
-
#!/bin/sh
|
| 2 |
-
|
| 3 |
-
# syntax=docker/dockerfile:1.4
|
| 4 |
-
FROM python:3.10-slim
|
| 5 |
-
|
| 6 |
-
WORKDIR /app
|
| 7 |
-
|
| 8 |
-
# Install system dependencies (kept minimal for faster builds)
|
| 9 |
-
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 10 |
-
gcc \
|
| 11 |
-
g++ \
|
| 12 |
-
postgresql-client \
|
| 13 |
-
curl \
|
| 14 |
-
&& rm -rf /var/lib/apt/lists/*
|
| 15 |
-
|
| 16 |
-
# Copy requirements and install Python dependencies
|
| 17 |
-
COPY requirements.txt .
|
| 18 |
-
RUN --mount=type=cache,target=/root/.cache/pip \
|
| 19 |
-
pip install --no-cache-dir -r requirements.txt
|
| 20 |
-
|
| 21 |
-
# Copy application code
|
| 22 |
-
COPY . .
|
| 23 |
-
|
| 24 |
-
# Create data directory for SQLite fallback
|
| 25 |
-
RUN mkdir -p /app/data
|
| 26 |
-
|
| 27 |
-
# Expose ports
|
| 28 |
-
# - 7860: Gradio UI (default HF Spaces port)
|
| 29 |
-
# - 8000: FastAPI backend
|
| 30 |
-
# - 8900: MCP server
|
| 31 |
-
EXPOSE 7860 8000 8900
|
| 32 |
-
|
| 33 |
-
# Set environment variables with defaults
|
| 34 |
-
ENV PYTHONPATH=/app
|
| 35 |
-
ENV API_PORT=8000
|
| 36 |
-
ENV MCP_PORT=8900
|
| 37 |
-
ENV BACKEND_BASE_URL=http://localhost:8000
|
| 38 |
-
ENV RAG_MCP_URL=http://localhost:8900/rag
|
| 39 |
-
ENV WEB_MCP_URL=http://localhost:8900/web
|
| 40 |
-
ENV ADMIN_MCP_URL=http://localhost:8900/admin
|
| 41 |
-
|
| 42 |
-
# Create startup script that runs all services
|
| 43 |
-
RUN echo '#!/bin/bash\n\
|
| 44 |
-
set -e\n\
|
| 45 |
-
\n\
|
| 46 |
-
# Function to wait for a service to be ready\n\
|
| 47 |
-
wait_for_service() {\n\
|
| 48 |
-
local url=$1\n\
|
| 49 |
-
local max_attempts=30\n\
|
| 50 |
-
local attempt=0\n\
|
| 51 |
-
\n\
|
| 52 |
-
echo "Waiting for $url to be ready..."\n\
|
| 53 |
-
while [ $attempt -lt $max_attempts ]; do\n\
|
| 54 |
-
if curl -s -f "$url" > /dev/null 2>&1; then\n\
|
| 55 |
-
echo "$url is ready!"\n\
|
| 56 |
-
return 0\n\
|
| 57 |
-
fi\n\
|
| 58 |
-
attempt=$((attempt + 1))\n\
|
| 59 |
-
sleep 1\n\
|
| 60 |
-
done\n\
|
| 61 |
-
\n\
|
| 62 |
-
echo "Warning: $url did not become ready after $max_attempts attempts"\n\
|
| 63 |
-
return 1\n\
|
| 64 |
-
}\n\
|
| 65 |
-
\n\
|
| 66 |
-
# Start MCP server in background\n\
|
| 67 |
-
echo "Starting MCP server on port $MCP_PORT..."\n\
|
| 68 |
-
python -m backend.mcp_server.server &\n\
|
| 69 |
-
MCP_PID=$!\n\
|
| 70 |
-
\n\
|
| 71 |
-
# Wait for MCP server to be ready\n\
|
| 72 |
-
sleep 5\n\
|
| 73 |
-
if ! kill -0 $MCP_PID 2>/dev/null; then\n\
|
| 74 |
-
echo "Error: MCP server failed to start"\n\
|
| 75 |
-
exit 1\n\
|
| 76 |
-
fi\n\
|
| 77 |
-
\n\
|
| 78 |
-
# Start FastAPI backend in background\n\
|
| 79 |
-
echo "Starting FastAPI backend on port $API_PORT..."\n\
|
| 80 |
-
uvicorn backend.api.main:app --host 0.0.0.0 --port $API_PORT &\n\
|
| 81 |
-
API_PID=$!\n\
|
| 82 |
-
\n\
|
| 83 |
-
# Wait for FastAPI to be ready\n\
|
| 84 |
-
sleep 5\n\
|
| 85 |
-
if ! kill -0 $API_PID 2>/dev/null; then\n\
|
| 86 |
-
echo "Error: FastAPI backend failed to start"\n\
|
| 87 |
-
exit 1\n\
|
| 88 |
-
fi\n\
|
| 89 |
-
\n\
|
| 90 |
-
# Wait for health check\n\
|
| 91 |
-
wait_for_service "http://localhost:$API_PORT/health" || true\n\
|
| 92 |
-
\n\
|
| 93 |
-
# Start Gradio UI (foreground - this is the main process)\n\
|
| 94 |
-
echo "Starting Gradio UI on port 7860..."\n\
|
| 95 |
-
echo "All services are running:"\n\
|
| 96 |
-
echo " - MCP Server: http://localhost:$MCP_PORT"\n\
|
| 97 |
-
echo " - FastAPI Backend: http://localhost:$API_PORT"\n\
|
| 98 |
-
echo " - Gradio UI: http://localhost:7860"\n\
|
| 99 |
-
python app.py\n\
|
| 100 |
-
' > /app/start.sh && chmod +x /app/start.sh
|
| 101 |
-
|
| 102 |
-
# Use the startup script as entrypoint
|
| 103 |
-
CMD ["/app/start.sh"]
|
| 104 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|