Update Dockerfile
Browse files- Dockerfile +21 -13
Dockerfile
CHANGED
|
@@ -1,8 +1,8 @@
|
|
| 1 |
-
# Synapse-Base Inference -
|
|
|
|
| 2 |
|
| 3 |
FROM python:3.10-slim
|
| 4 |
|
| 5 |
-
# Set working directory
|
| 6 |
WORKDIR /app
|
| 7 |
|
| 8 |
# Install system dependencies
|
|
@@ -11,34 +11,42 @@ RUN apt-get update && apt-get install -y \
|
|
| 11 |
curl \
|
| 12 |
&& rm -rf /var/lib/apt/lists/*
|
| 13 |
|
| 14 |
-
# Copy requirements
|
| 15 |
COPY requirements.txt .
|
| 16 |
-
|
| 17 |
-
# Install Python dependencies
|
| 18 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 19 |
|
|
|
|
|
|
|
|
|
|
| 20 |
# Copy application code
|
| 21 |
COPY app.py .
|
| 22 |
-
COPY engine
|
| 23 |
-
COPY
|
| 24 |
|
| 25 |
-
# Download model from HuggingFace
|
| 26 |
RUN python -c "from huggingface_hub import hf_hub_download; \
|
| 27 |
-
hf_hub_download(
|
| 28 |
-
|
| 29 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
|
| 31 |
# Expose port
|
| 32 |
EXPOSE 7860
|
| 33 |
|
| 34 |
-
#
|
| 35 |
ENV PYTHONUNBUFFERED=1
|
| 36 |
ENV OMP_NUM_THREADS=2
|
| 37 |
ENV MKL_NUM_THREADS=2
|
|
|
|
| 38 |
|
| 39 |
# Health check
|
| 40 |
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
|
| 41 |
CMD curl -f http://localhost:7860/health || exit 1
|
| 42 |
|
| 43 |
-
# Run
|
| 44 |
CMD ["python", "app.py"]
|
|
|
|
| 1 |
+
# Synapse-Base Inference - State-of-the-Art Search Engine
|
| 2 |
+
# Optimized for HF Spaces CPU (2 vCPU, 16GB RAM)
|
| 3 |
|
| 4 |
FROM python:3.10-slim
|
| 5 |
|
|
|
|
| 6 |
WORKDIR /app
|
| 7 |
|
| 8 |
# Install system dependencies
|
|
|
|
| 11 |
curl \
|
| 12 |
&& rm -rf /var/lib/apt/lists/*
|
| 13 |
|
| 14 |
+
# Copy requirements
|
| 15 |
COPY requirements.txt .
|
|
|
|
|
|
|
| 16 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 17 |
|
| 18 |
+
# Create directory structure
|
| 19 |
+
RUN mkdir -p /app/models /app/engine /app/utils
|
| 20 |
+
|
| 21 |
# Copy application code
|
| 22 |
COPY app.py .
|
| 23 |
+
COPY engine/ ./engine/
|
| 24 |
+
COPY utils/ ./utils/
|
| 25 |
|
| 26 |
+
# Download Synapse-Base model from HuggingFace
|
| 27 |
RUN python -c "from huggingface_hub import hf_hub_download; \
|
| 28 |
+
hf_hub_download( \
|
| 29 |
+
repo_id='GambitFlow/Synapse-Base', \
|
| 30 |
+
filename='synapse_base.onnx', \
|
| 31 |
+
local_dir='/app/models', \
|
| 32 |
+
local_dir_use_symlinks=False \
|
| 33 |
+
)"
|
| 34 |
+
|
| 35 |
+
# Verify model exists
|
| 36 |
+
RUN ls -lh /app/models/synapse_base.onnx
|
| 37 |
|
| 38 |
# Expose port
|
| 39 |
EXPOSE 7860
|
| 40 |
|
| 41 |
+
# Environment variables for CPU optimization
|
| 42 |
ENV PYTHONUNBUFFERED=1
|
| 43 |
ENV OMP_NUM_THREADS=2
|
| 44 |
ENV MKL_NUM_THREADS=2
|
| 45 |
+
ENV OPENBLAS_NUM_THREADS=2
|
| 46 |
|
| 47 |
# Health check
|
| 48 |
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
|
| 49 |
CMD curl -f http://localhost:7860/health || exit 1
|
| 50 |
|
| 51 |
+
# Run
|
| 52 |
CMD ["python", "app.py"]
|