Datathon / Dockerfile.txt
Sathvik-kota's picture
Upload folder using huggingface_hub
b4c9981 verified
This removes the configuration error.
---
## 2️⃣ Dockerfile (adapted for FastAPI app)
Use your existing Dockerfile but tweaked slightly for Spaces + FastAPI:
```dockerfile
# Use a standard Python 3.11 slim image
FROM python:3.11-slim
# Set up a new user named "user" with user ID 1000 (required by HF Spaces)
RUN useradd -m -u 1000 user
# Switch to the "user" user
USER user
# Set home to the user's home directory
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
# Set the working directory to the user's home directory
WORKDIR $HOME/app
# Copy the requirements file first to leverage Docker layer caching
COPY --chown=user requirements.txt .
# Install all your Python dependencies
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r requirements.txt
# Copy all your project files into the container with proper ownership
COPY --chown=user . .
# Make our startup script executable
RUN chmod +x ./start.sh
# Hugging Face Spaces will set PORT env; default to 7860 if not set
EXPOSE 7860
# Run the startup script when the container starts
CMD ["./start.sh"]