Spaces:
Configuration error
Configuration error
File size: 716 Bytes
591f049 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
FROM python:3.9
# 1. Create a non-root user
RUN useradd -m -u 1000 user
USER user
# 2. Set environment variables to ensure Python finds installed packages
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH \
PYTHONPATH=/home/user/app
WORKDIR /app
# 3. Upgrade pip first (important for newer packages)
RUN pip install --no-cache-dir --upgrade pip
# 4. Copy requirements and install
COPY --chown=user requirements.txt .
# Adding --user ensures packages go to the path we set above
RUN pip install --no-cache-dir --user -r requirements.txt
# 5. Copy the rest of your app
COPY --chown=user . .
# 6. Run the app
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] |