sarveshpatel commited on
Commit
0510bea
·
verified ·
1 Parent(s): 62366a2

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +58 -0
Dockerfile ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.11-slim
2
+
3
+ # Set environment variables
4
+ ENV PYTHONUNBUFFERED=1 \
5
+ PYTHONDONTWRITEBYTECODE=1 \
6
+ PIP_NO_CACHE_DIR=1 \
7
+ PIP_DISABLE_PIP_VERSION_CHECK=1 \
8
+ CODE_STORAGE_DIR=/app/code_storage \
9
+ ENV_TYPE=venv-uv \
10
+ UV_VENV_PATH=/app/executor_venv \
11
+ WORKERS=4 \
12
+ MAX_CONCURRENT_EXECUTIONS=20 \
13
+ EXECUTION_TIMEOUT=120 \
14
+ HF_SPACE=1
15
+
16
+ # Install system dependencies
17
+ RUN apt-get update && apt-get install -y --no-install-recommends \
18
+ build-essential \
19
+ curl \
20
+ git \
21
+ && rm -rf /var/lib/apt/lists/*
22
+
23
+ # Install uv for fast package management
24
+ RUN curl -LsSf https://astral.sh/uv/install.sh | sh
25
+ ENV PATH="/root/.cargo/bin:$PATH"
26
+
27
+ # Create app directory
28
+ WORKDIR /app
29
+
30
+ # Copy requirements first for layer caching
31
+ COPY requirements.txt .
32
+ RUN pip install --no-cache-dir -r requirements.txt
33
+
34
+ # Create the executor virtual environment using uv
35
+ RUN uv venv /app/executor_venv && \
36
+ . /app/executor_venv/bin/activate && \
37
+ uv pip install numpy pandas matplotlib scikit-learn requests pillow scipy sympy && \
38
+ deactivate
39
+
40
+ # Create code storage directory
41
+ RUN mkdir -p /app/code_storage && chmod 777 /app/code_storage
42
+
43
+ # Copy application code
44
+ COPY . .
45
+
46
+ # Copy and set permissions for start script
47
+ COPY scripts/start.sh /app/scripts/start.sh
48
+ RUN chmod +x /app/scripts/start.sh
49
+
50
+ # Expose HF Spaces port
51
+ EXPOSE 7860
52
+
53
+ # Health check
54
+ HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
55
+ CMD curl -f http://localhost:7860/health || exit 1
56
+
57
+ # Start the application
58
+ CMD ["/app/scripts/start.sh"]