Spaces:
Sleeping
Sleeping
# Use an official Python runtime as a parent image | |
FROM python:3.9-slim AS base | |
RUN apt-get update && \ | |
apt-get install -y git | |
RUN useradd -m -u 1000 user | |
USER user | |
ENV HOME=/home/user \ | |
PATH=/home/user/.local/bin:$PATH | |
# Set environment variables | |
ENV PYTHONUNBUFFERED=1 | |
# Set the working directory in the container | |
WORKDIR $HOME/app | |
# There was a problem with the permission of the HuggingFace's cache directory, so we changed the path to another that should be writeable. | |
ENV HF_HOME=$HOME/app/.cache | |
# Copy the requirements file into the container | |
COPY requirements.txt . | |
# Install dependencies | |
RUN pip install --no-cache-dir -r requirements.txt | |
# Copy the application code into the container | |
COPY --chown=user . . | |
# Stage: Execute a test for the text search engine. | |
FROM base AS debug | |
CMD ["python", "-m", "pdb", "text_search_engine.py"] | |
# Stage: Execute the Streamlit application. | |
FROM base AS run | |
CMD ["streamlit", "run", "streamlit_app.py", "--server.port", "7860"] | |