File size: 1,558 Bytes
aefa85f 87698a7 aefa85f 87698a7 b06455f aefa85f 87698a7 b06455f 87698a7 25913af 87698a7 25913af 501facf 87698a7 25913af 87698a7 b048687 5885a9b 87698a7 55ce2db 87698a7 25913af 87698a7 b06455f 87698a7 b06455f 87698a7 a74ea85 38c8e16 aefa85f 87698a7 38c8e16 a2fb242 87698a7 b06455f 87698a7 a2fb242 0929322 a2fb242 87698a7 a74ea85 5885a9b 87698a7 61006ad | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | FROM python:3.10-slim
# ==============================
# SYSTEM DEPENDENCIES
# ==============================
RUN apt-get update && apt-get install -y \
curl \
ffmpeg \
git \
build-essential \
libgomp1 \
procps \
ca-certificates \
zstd \
&& rm -rf /var/lib/apt/lists/*
# ==============================
# INSTALL OLLAMA
# ==============================
RUN curl -fsSL https://ollama.com/install.sh | sh
RUN ollama --version
# ==============================
# CREATE USER
# ==============================
RUN useradd -m -u 1000 user
WORKDIR /home/user/app
# ==============================
# CACHE DIRECTORY
# ==============================
RUN mkdir -p /home/user/app/models_cache && \
mkdir -p /home/user/app/models_cache/.ollama && \
chown -R user:user /home/user/app
ENV HF_HOME=/home/user/app/models_cache
ENV TRANSFORMERS_CACHE=/home/user/app/models_cache
ENV OLLAMA_MODELS=/home/user/app/models_cache/.ollama
ENV HOME=/home/user/app
ENV PYTHONUNBUFFERED=1
# ==============================
# PYTHON DEPENDENCIES
# ==============================
COPY requirements.txt .
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r requirements.txt
# ==============================
# COPY PROJECT
# ==============================
COPY . .
RUN chmod +x start.sh
# ==============================
# DOWNLOAD MODELS (OPTIONAL)
# ==============================
RUN python download_models.py || true
# ==============================
USER user
EXPOSE 7860
CMD ["./start.sh"] |