Spaces:
Sleeping
Sleeping
# Step 1: Use an official Python slim base image | |
FROM python:3.10-slim | |
# Step 2: Install system dependencies | |
RUN apt-get update && apt-get install -y \ | |
wget \ | |
tar \ | |
&& apt-get clean | |
# Step 3: Add a non-root user (required by Hugging Face Spaces) | |
RUN useradd -m -u 1000 user | |
# Step 4: Switch to the "user" user | |
USER user | |
# Step 5: Set home and working directory | |
ENV HOME=/home/user \ | |
PATH=/home/user/.local/bin:$PATH | |
WORKDIR $HOME/app | |
# Step 6: Copy requirements into the container | |
COPY --chown=user requirements.txt ./requirements.txt | |
# Step 7: Install Python dependencies | |
RUN pip install --no-cache-dir --upgrade pip && \ | |
pip install --no-cache-dir -r requirements.txt | |
# Step 8: Copy all necessary files and folders into the container | |
COPY --chown=user .output ./.output | |
COPY --chown=user cache ./cache | |
COPY --chown=user input ./input | |
COPY --chown=user output ./output | |
COPY --chown=user prompts ./prompts | |
COPY --chown=user reports ./reports | |
COPY --chown=user auth.py ./auth.py | |
COPY --chown=user knowledge_graph.html ./knowledge_graph.html | |
COPY --chown=user query_config.yaml ./query_config.yaml | |
COPY --chown=user app.py ./app.py | |
COPY --chown=user search_handlers.py ./search_handlers.py | |
COPY --chown=user settings.yaml ./settings.yaml | |
COPY --chown=user styles.css ./styles.css | |
COPY --chown=user wiki.py ./wiki.py | |
# Step 10: Expose the Streamlit default port | |
EXPOSE 7860 | |
# Step 11: Define the entrypoint command | |
CMD ["streamlit", "run", "app.py", "--server.port", "7860", "--server.address", "0.0.0.0"] |