Spaces:
Sleeping
Sleeping
Download Dockerfile from techSnipe/gait-analysis-backend: direct link, hf CLI and curl.
- Browser
- Download file 1.16 kB
-
https://huggingface.co/spaces/techSnipe/gait-analysis-backend/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/techSnipe/gait-analysis-backend/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/techSnipe/gait-analysis-backend/resolve/main/Dockerfile
1.16 kB
| # Dockerfile for Gait Analysis Microservice | |
| FROM python:3.10-slim | |
| # Install system dependencies required by OpenCV and YOLO | |
| RUN apt-get update && apt-get install -y \ | |
| libglib2.0-0 \ | |
| libsm6 \ | |
| libxext6 \ | |
| libxrender-dev \ | |
| libgl1 \ | |
| git \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Set the working directory in the container | |
| WORKDIR /app | |
| # Copy the requirements file into the container | |
| COPY requirements.txt . | |
| # Install ALL Python dependencies in a single layer for efficiency | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy the rest of the backend files into the container | |
| COPY . /app | |
| # ---- Download YOLO model at BUILD time ---- | |
| # This avoids a cold-start penalty on every container restart. | |
| # The model (~6 MB) is baked into the image layer. | |
| RUN python download_model.py | |
| # HuggingFace Spaces requires the app to run as a non-root user | |
| RUN useradd -m -u 1000 appuser && chown -R appuser /app | |
| USER appuser | |
| # Expose the port that HuggingFace Spaces routes to | |
| EXPOSE 7860 | |
| # Command to run the application using Uvicorn | |
| CMD ["uvicorn", "api:app", "--host", "0.0.0.0", "--port", "7860"] | |