2B / Dockerfile
37-AN
Initial commit for Hugging Face Space deployment
8faa239
raw
history blame
1.22 kB
FROM python:3.10-slim
WORKDIR /app
# Install required system dependencies
RUN apt-get update && apt-get install -y \
build-essential \
git \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements first for better caching
COPY requirements.txt .
# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Create cache directories with proper permissions
RUN mkdir -p /.cache && chmod 777 /.cache
RUN mkdir -p /root/.cache && chmod 777 /root/.cache
RUN mkdir -p /app/.cache && chmod 777 /app/.cache
# Create models directory for Hugging Face
RUN mkdir -p /app/models && chmod 777 /app/models
ENV TRANSFORMERS_CACHE=/app/models
# Copy the rest of the application
COPY . .
# Create necessary directories with proper permissions
RUN mkdir -p data/documents data/vector_db && \
chmod -R 777 data
# Set environment variable to avoid TOKENIZERS_PARALLELISM warning
ENV TOKENIZERS_PARALLELISM=false
ENV HF_HOME=/app/.cache
ENV XDG_CACHE_HOME=/app/.cache
# Expose the port required by Hugging Face Spaces
EXPOSE 7860
# Set the entrypoint command to run the Streamlit app on port 7860
CMD ["streamlit", "run", "app/ui/streamlit_app.py", "--server.port=7860", "--server.address=0.0.0.0"]