MobileCLIP / Dockerfile
101Frost's picture
Update Dockerfile
c2abe3b verified
FROM python:3.10-slim
WORKDIR /app
# Fix for numpy and torch compatibility
RUN apt-get update && apt-get install -y \
git \
build-essential \
libopenblas-dev \
liblapack-dev \
libffi-dev \
libglib2.0-0 \
libsm6 \
libxext6 \
libxrender-dev \
&& rm -rf /var/lib/apt/lists/*
# Create cache dirs
RUN mkdir -p /app/.cache && chmod 777 /app/.cache
RUN mkdir -p /app/.cache/torch && chmod 777 /app/.cache/torch
RUN mkdir -p /app/.cache/transformers && chmod 777 /app/.cache/transformers
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
RUN git clone https://github.com/apple/ml-mobileclip.git && \
cd ml-mobileclip && \
pip install -e . --no-deps && \
cd .. && \
rm -rf ml-mobileclip/.git
COPY app.py .
EXPOSE 7860
ENV PYTHONPATH=/app
ENV PYTHONUNBUFFERED=1
ENV HF_HOME=/app/.cache
ENV TORCH_HOME=/app/.cache/torch
ENV TRANSFORMERS_CACHE=/app/.cache/transformers
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]