Agentic / Dockerfile
sahilmayekar's picture
Update Dockerfile
0f59a99 verified
FROM ollama/ollama:latest
# Change to custom app directory
WORKDIR /app
ENV HOME=/app
# Add ollama user and ensure home + ollama directories
RUN groupadd -r ollama && useradd -r -g ollama ollama \
&& mkdir -p /app/.ollama /app/.streamlit \
&& chown -R ollama:ollama /app
# Install packages
RUN apt-get update && apt-get install -y \
build-essential \
curl \
software-properties-common \
git \
python3 \
python3-pip \
python3-venv \
netcat-openbsd \
&& rm -rf /var/lib/apt/lists/*
# Copy files
COPY requirements.txt ./
COPY src/ ./src/
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
# Set up Python virtual environment
RUN python3 -m venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"
# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Make entrypoint executable
RUN chmod +x /usr/local/bin/entrypoint.sh
# Ensure all necessary dirs are accessible
RUN chmod -R 777 /app/.streamlit /app/.ollama
# Switch to ollama user
USER ollama
# Set Ollama to listen on all interfaces
ENV OLLAMA_HOST=0.0.0.0:11434
EXPOSE 11434 8501
# Healthcheck for Streamlit (adjust if needed)
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]