Spaces:
Runtime error
Runtime error
File size: 938 Bytes
ea49aa0 e2b9650 be9ae22 3eba73f 6c7c8b9 e2b9650 be9ae22 6c7c8b9 e2b9650 5bfd791 0e5b706 5bfd791 3221d82 be9ae22 6c7c8b9 5bfd791 ea49aa0 9643612 be9ae22 c7b1857 ea49aa0 5bfd791 ea49aa0 5bfd791 | 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 27 28 29 30 31 32 | FROM python:3.13-slim
# 1. Setup User
RUN useradd -m -u 1000 user
WORKDIR /home/user/app
# 2. Install UV
COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv
# 3. Copy files
COPY --chown=user . .
# 4. Install dependencies
# We install fastapi and uvicorn into the workspace environment
RUN /usr/local/bin/uv sync --all-extras && \
/usr/local/bin/uv add fastapi uvicorn
# 5. Fix Permissions (Crucial for Hugging Face)
RUN chown -R user:user /home/user/app
# 6. Switch to non-root user
USER user
# 7. Environment Setup
ENV PORT=7860
# This allows 'import duckdb_loader' to work from the app root
ENV PYTHONPATH=/home/user/app/duckdb_loader
EXPOSE 7860
# 8. THE CMD: Navigate the double-nest
# Package (duckdb_loader) -> Sub-Package (duckdb_loader) -> Module (main) -> Object (app)
CMD ["/usr/local/bin/uv", "run", "python", "-m", "uvicorn", "duckdb_loader.duckdb_loader.main:app", "--host", "0.0.0.0", "--port", "7860"] |