Upload 11 files
Browse files- Dockerfile +11 -44
- index.html +0 -0
- main.py +2 -0
Dockerfile
CHANGED
|
@@ -1,35 +1,22 @@
|
|
| 1 |
-
# Dockerfile for Crypto API Monitoring System
|
| 2 |
-
# Optimized for HuggingFace Spaces deployment
|
| 3 |
FROM python:3.10-slim
|
| 4 |
|
| 5 |
-
# Set working directory
|
| 6 |
WORKDIR /app
|
| 7 |
|
| 8 |
-
#
|
| 9 |
-
|
| 10 |
-
PYTHONDONTWRITEBYTECODE=1 \
|
| 11 |
-
PIP_NO_CACHE_DIR=1 \
|
| 12 |
-
PIP_DISABLE_PIP_VERSION_CHECK=1
|
| 13 |
|
| 14 |
-
# Install system dependencies
|
| 15 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 16 |
-
|
| 17 |
-
g++ \
|
| 18 |
-
git \
|
| 19 |
-
curl \
|
| 20 |
&& rm -rf /var/lib/apt/lists/*
|
| 21 |
|
| 22 |
-
#
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
# Install Python dependencies with optimizations
|
| 26 |
-
# Split into two steps: core dependencies first, then ML libraries
|
| 27 |
RUN pip install --no-cache-dir \
|
| 28 |
fastapi==0.104.1 \
|
| 29 |
uvicorn[standard]==0.24.0 \
|
| 30 |
pydantic==2.5.0 \
|
| 31 |
python-multipart==0.0.6 \
|
| 32 |
-
websockets==12.0 \
|
| 33 |
SQLAlchemy==2.0.23 \
|
| 34 |
APScheduler==3.10.4 \
|
| 35 |
aiohttp==3.9.1 \
|
|
@@ -41,31 +28,11 @@ RUN pip install --no-cache-dir \
|
|
| 41 |
pandas==2.1.4 \
|
| 42 |
plotly==5.18.0
|
| 43 |
|
| 44 |
-
#
|
| 45 |
-
RUN pip install --no-cache-dir \
|
| 46 |
-
transformers>=4.44.0 \
|
| 47 |
-
datasets>=3.0.0 \
|
| 48 |
-
huggingface_hub>=0.24.0 \
|
| 49 |
-
torch>=2.0.0 --index-url https://download.pytorch.org/whl/cpu \
|
| 50 |
-
sentencepiece>=0.1.99 \
|
| 51 |
-
protobuf>=3.20.0
|
| 52 |
-
|
| 53 |
-
# Copy all application code
|
| 54 |
-
COPY . .
|
| 55 |
-
|
| 56 |
-
# Create necessary directories
|
| 57 |
-
RUN mkdir -p data logs
|
| 58 |
-
|
| 59 |
-
# Set proper permissions for data directories
|
| 60 |
-
RUN chmod -R 755 data logs
|
| 61 |
-
|
| 62 |
-
# Expose port 7860 (HuggingFace Spaces standard port)
|
| 63 |
EXPOSE 7860
|
| 64 |
|
| 65 |
-
#
|
| 66 |
-
|
| 67 |
-
CMD curl -f http://localhost:7860/health || exit 1
|
| 68 |
|
| 69 |
-
#
|
| 70 |
-
|
| 71 |
-
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--log-level", "info", "--workers", "1"]
|
|
|
|
|
|
|
|
|
|
| 1 |
FROM python:3.10-slim
|
| 2 |
|
|
|
|
| 3 |
WORKDIR /app
|
| 4 |
|
| 5 |
+
# Copy project files into the image
|
| 6 |
+
COPY . /app
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
+
# Install system dependencies if needed (optional, keep minimal)
|
| 9 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 10 |
+
build-essential \
|
|
|
|
|
|
|
|
|
|
| 11 |
&& rm -rf /var/lib/apt/lists/*
|
| 12 |
|
| 13 |
+
# Install Python dependencies
|
| 14 |
+
# NOTE: websockets version is NOT pinned to 12.0 to avoid conflict with gradio_client
|
|
|
|
|
|
|
|
|
|
| 15 |
RUN pip install --no-cache-dir \
|
| 16 |
fastapi==0.104.1 \
|
| 17 |
uvicorn[standard]==0.24.0 \
|
| 18 |
pydantic==2.5.0 \
|
| 19 |
python-multipart==0.0.6 \
|
|
|
|
| 20 |
SQLAlchemy==2.0.23 \
|
| 21 |
APScheduler==3.10.4 \
|
| 22 |
aiohttp==3.9.1 \
|
|
|
|
| 28 |
pandas==2.1.4 \
|
| 29 |
plotly==5.18.0
|
| 30 |
|
| 31 |
+
# Expose the port that Hugging Face expects (7860 by default)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
EXPOSE 7860
|
| 33 |
|
| 34 |
+
# For HF Spaces compatibility
|
| 35 |
+
ENV PORT=7860
|
|
|
|
| 36 |
|
| 37 |
+
# Main entrypoint: use main:app (FastAPI)
|
| 38 |
+
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860", "--proxy-headers", "--forwarded-allow-ips", "*"]
|
|
|
index.html
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|
main.py
CHANGED
|
@@ -1,3 +1,5 @@
|
|
| 1 |
from app import app as fastapi_app
|
| 2 |
|
|
|
|
|
|
|
| 3 |
app = fastapi_app
|
|
|
|
| 1 |
from app import app as fastapi_app
|
| 2 |
|
| 3 |
+
# Uvicorn / Hugging Face entrypoint
|
| 4 |
+
# This file allows us to run: uvicorn main:app ...
|
| 5 |
app = fastapi_app
|