Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files123455 unmodified lines11121314151617181920212223242526# 1. Use Python 3.10 (Better support for ChromaDB/SQLite)FROM python:3.10# 2. Set up the user FIRST (Security requirement)RUN useradd -m -u 1000 user5 unmodified linesCOPY --chown=user ./requirements.txt /code/requirements.txtRUN pip install --no-cache-dir --upgrade -r /code/requirements.txt# 5. COPY EVERYTHING (Crucial Change: --chown=user)# This ensures 'user' owns the database files and can write to themCOPY --chown=user . /code# 6. Switch to the non-root userUSER user# 7. Set Environment VariablesENV HOME=/home/user \PATH=/home/user/.local/bin:$PATH# 8. Run the AppCMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]123455 unmodified lines1112131415161718192021222324252627282930# 1. Use Python 3.9FROM python:3.9# 2. Set up the user FIRST (Security requirement)RUN useradd -m -u 1000 user5 unmodified linesCOPY --chown=user ./requirements.txt /code/requirements.txtRUN pip install --no-cache-dir --upgrade -r /code/requirements.txt# 5. COPY EVERYTHING with Ownership Fix# This tells Docker: "Make 'user' the owner of all these files, not Root"COPY --chown=user . /code# 6. FORCE PERMISSIONS (The Fix for Error 13)# This grants Read/Write access to the folder so SQLite can create lock filesRUN chmod -R 777 /code# 7. Switch to the non-root userUSER user# 8. Set Environment VariablesENV HOME=/home/user \PATH=/home/user/.local/bin:$PATH# 9. Run the AppCMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
Dockerfile+11-7