Spaces:
Sleeping
Sleeping
Create Dockerfile
Browse files- Dockerfile +45 -0
Dockerfile
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM python:3.11-slim-bullseye
|
| 2 |
+
|
| 3 |
+
# Install system dependencies
|
| 4 |
+
RUN sed -i 's/main/main contrib non-free/' /etc/apt/sources.list && \
|
| 5 |
+
apt-get update && \
|
| 6 |
+
apt-get install -y --no-install-recommends \
|
| 7 |
+
unrar \
|
| 8 |
+
libgl1 \
|
| 9 |
+
libglib2.0-0 \
|
| 10 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 11 |
+
|
| 12 |
+
WORKDIR /app
|
| 13 |
+
|
| 14 |
+
# Upgrade pip and install core dependencies first
|
| 15 |
+
RUN pip install --no-cache-dir --upgrade pip setuptools wheel packaging
|
| 16 |
+
|
| 17 |
+
# Install CPU-only PyTorch first
|
| 18 |
+
|
| 19 |
+
# Copy requirements and install with special handling for flash_attn
|
| 20 |
+
COPY requirements.txt .
|
| 21 |
+
RUN pip install --no-cache-dir \
|
| 22 |
+
-r requirements.txt \
|
| 23 |
+
--find-links https://download.pytorch.org/whl/cpu \
|
| 24 |
+
--extra-index-url https://pypi.org/simple && \
|
| 25 |
+
# Install remaining packages that might have been skipped
|
| 26 |
+
pip install --no-cache-dir \
|
| 27 |
+
accelerate \
|
| 28 |
+
transformers==4.36.2 \
|
| 29 |
+
timm==0.9.12 \
|
| 30 |
+
einops==0.7.0
|
| 31 |
+
|
| 32 |
+
# Copy application code
|
| 33 |
+
COPY . .
|
| 34 |
+
|
| 35 |
+
# Create non-root user
|
| 36 |
+
RUN useradd -m -u 1000 user && \
|
| 37 |
+
chown -R user:user /app
|
| 38 |
+
|
| 39 |
+
USER user
|
| 40 |
+
|
| 41 |
+
# Environment variables to suppress warnings
|
| 42 |
+
ENV HF_HUB_DISABLE_PROGRESS=1
|
| 43 |
+
ENV TF_CPP_MIN_LOG_LEVEL=3
|
| 44 |
+
|
| 45 |
+
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|