Spaces:
Sleeping
Sleeping
File size: 1,156 Bytes
83ee618 eae4a15 83ee618 | 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 33 34 35 36 37 38 39 40 | # 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"]
|