Spaces:
Sleeping
Sleeping
Upload Dockerfile with huggingface_hub
Browse files- Dockerfile +38 -0
Dockerfile
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Hugging Face Spaces - Crypto Data Source Ultimate
|
| 2 |
+
# Docker-based deployment for complete API backend + Static Frontend
|
| 3 |
+
|
| 4 |
+
FROM python:3.10-slim
|
| 5 |
+
|
| 6 |
+
# Set working directory
|
| 7 |
+
WORKDIR /app
|
| 8 |
+
|
| 9 |
+
# Install system dependencies
|
| 10 |
+
RUN apt-get update && apt-get install -y \
|
| 11 |
+
curl \
|
| 12 |
+
git \
|
| 13 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 14 |
+
|
| 15 |
+
# Copy requirements first (for better caching)
|
| 16 |
+
COPY requirements.txt .
|
| 17 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 18 |
+
|
| 19 |
+
# Copy the entire project
|
| 20 |
+
COPY . .
|
| 21 |
+
|
| 22 |
+
# Create data directory for SQLite databases
|
| 23 |
+
RUN mkdir -p data
|
| 24 |
+
|
| 25 |
+
# Expose port 7860 (Hugging Face Spaces standard)
|
| 26 |
+
EXPOSE 7860
|
| 27 |
+
|
| 28 |
+
# Environment variables (can be overridden in HF Spaces settings)
|
| 29 |
+
ENV HOST=0.0.0.0
|
| 30 |
+
ENV PORT=7860
|
| 31 |
+
ENV PYTHONUNBUFFERED=1
|
| 32 |
+
|
| 33 |
+
# Health check
|
| 34 |
+
HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
|
| 35 |
+
CMD curl -f http://localhost:7860/api/health || exit 1
|
| 36 |
+
|
| 37 |
+
# Start the FastAPI server using app.py (simpler, more stable)
|
| 38 |
+
CMD ["python", "-m", "uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1", "--timeout-keep-alive", "75"]
|