Englsih-LLM-TTS / Dockerfile
MaenGit
update Docfile
738c248
# Start from Ollama's official image
FROM ollama/ollama
# Remove the default entrypoint
ENTRYPOINT []
# Install Python essentials
RUN apt-get update && apt-get install -y --no-install-recommends \
python3 \
python3-pip \
python3-venv \
curl \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Set up Virtual Env
RUN python3 -m venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"
# Install requirements
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy your code
COPY . .
# FIX: The user with UID 1000 already exists in this image,
# we just need to make sure they own the /app and the ollama path.
RUN chown -R 1000:1000 /app && \
mkdir -p /home/ollama/.ollama && \
chown -R 1000:1000 /home/ollama/.ollama
# Set the home and model path for the existing user
ENV HOME=/home/ollama \
OLLAMA_MODELS=/home/ollama/.ollama
# Switch to the existing user (UID 1000)
USER 1000
# Hugging Face standard port
EXPOSE 7860
# Startup command
CMD sh -c "ollama serve & sleep 5 && ollama pull llama3.2:1b && uvicorn main:app --host 0.0.0.0 --port 7860 --timeout-keep-alive 65"