Spaces:
Runtime error
Runtime error
| # Use an official Python runtime as a parent image | |
| FROM python:3.9 | |
| # Install system dependencies required by OpenCV | |
| RUN apt-get update && apt-get install -y \ | |
| libgl1-mesa-glx \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Create a non-root user with a specified user ID | |
| RUN useradd -m -u 1000 user | |
| # Set environment variables for the non-root user | |
| ENV HOME=/home/user \ | |
| PATH=/home/user/.local/bin:$PATH \ | |
| NAME=EduConnect \ | |
| EC_ADMIN_PWD='$2b$12$wGncNhE7OVmsb7TKFuNPKuJfKOIKdGtw302VMDJbAPrHrY73jqID.' \ | |
| HF_MODEL_NAME="BitBasher/llama-2-7b-mini-ibased-GGUF" \ | |
| GGUF_MODEL_URL='https://huggingface.co/BitBasher/llama-2-7b-mini-ibased-GGUF/resolve/main/llama-2-7b-mini-ibased.Q5_K_M.gguf' \ | |
| MODEL_CLASS='gguf' \ | |
| CHROMADB_LOC='/home/user/data/chromadb' \ | |
| HF_HOME=/data/.huggingface | |
| # Set the non-root user's home directory as the working directory | |
| WORKDIR $HOME | |
| # Change to the non-root user | |
| USER user | |
| # Copy only the requirements.txt first to leverage Docker cache | |
| COPY --chown=user:user requirements.txt $HOME/app/ | |
| # Copy Static files for Jinja2 templates | |
| COPY --chown=user:user ./static /home/user/app/static | |
| # Install any needed packages specified in requirements.txt | |
| RUN pip install --no-cache-dir --user -r $HOME/app/requirements.txt | |
| # Set the working directory to where the application files will be located | |
| WORKDIR $HOME/app | |
| # Copy the rest of the application files into the container | |
| COPY --chown=user:user ./app . | |
| # Create a symbolic link from /data to /home/user/data | |
| RUN ln -s /data /home/user/data | |
| # Set Python path just to make sure | |
| ENV PYTHONPATH="/home/user/app:${PYTHONPATH}" | |
| # Make port 7860 available to the world outside this container | |
| EXPOSE 7860 | |
| # Adjust the COPY command for the entrypoint script to ensure correct placement | |
| COPY --chown=user:user entrypoint.sh /home/user/entrypoint.sh | |
| # Change permission of entrypoint.sh and make sure it is executable | |
| RUN chmod +x /home/user/entrypoint.sh | |
| # Update the ENTRYPOINT command to use the full path to entrypoint.sh | |
| ENTRYPOINT ["/home/user/entrypoint.sh"] | |
| # Adjust the CMD to ensure it correctly references the FastAPI app | |
| CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"] | |