Be-AI / Dockerfile
imbecome's picture
Update Dockerfile
b06455f verified
Raw History Blame Contribute Delete
1.56 kB
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"]