File size: 1,082 Bytes
7cf93e2 376b382 7cf93e2 376b382 8647bae 80b7de3 376b382 8647bae 376b382 cf44ba8 17aad32 376b382 cf44ba8 17aad32 892b02b 7cf93e2 376b382 892b02b 376b382 7cf93e2 376b382 892b02b 7cf93e2 376b382 7cf93e2 892b02b 13bbf4a |
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 |
# 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"] |