assistant / Dockerfile
JumaRubea's picture
Update Dockerfile
13bbf4a verified
# Use official Python slim image
FROM python:3.10-slim
# Set working directory
WORKDIR /app
# Install system dependencies (for transformers, torch, sqlite)
RUN apt update && apt install -y \
build-essential \
curl \
git \
sqlite3 \
&& rm -rf /var/lib/apt/lists/*
# Create /data directory and set permissions
RUN mkdir -p /data && \
chown -R 1000:1000 /data && \
chmod -R 755 /data
# Copy requirements and source code
COPY requirements.txt ./
COPY src/ ./src/
# If chats.db exists in src/, copy it to /data (optional)
RUN [ -f src/chats.db ] && cp src/chats.db /data/chats.db || true
# Upgrade pip and install Python dependencies
RUN pip install --upgrade pip
RUN pip install -r requirements.txt
# Expose Streamlit and FastAPI ports
EXPOSE 8501
EXPOSE 8000
# Huggingface cache
ENV HF_HOME=/tmp/huggingface_cache
# Healthcheck for Streamlit
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1
# Run the Streamlit app
ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"]