Spaces:
Sleeping
Sleeping
| FROM python:3.10-slim | |
| WORKDIR /code | |
| # Install system dependencies | |
| RUN apt-get update && apt-get install -y \ | |
| libgl1-mesa-glx \ | |
| libglib2.0-0 \ | |
| ffmpeg \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Copy requirements first to leverage Docker cache | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Create necessary directories with proper permissions | |
| RUN mkdir -p /code/static/uploads \ | |
| && mkdir -p /code/logs \ | |
| && mkdir -p /code/external/BodybuildingPoseClassifier \ | |
| && mkdir -p /code/templates \ | |
| && chmod -R 777 /code/static/uploads \ | |
| && chmod -R 777 /code/logs \ | |
| && chmod -R 777 /code/external \ | |
| && chmod -R 777 /code/templates | |
| # Copy the entire application first | |
| COPY . . | |
| # Verify model file exists and has correct permissions | |
| RUN ls -la /code/external/BodybuildingPoseClassifier/ && \ | |
| chmod 644 /code/external/BodybuildingPoseClassifier/bodybuilding_pose_classifier.h5 | |
| # Set environment variables | |
| ENV PYTHONUNBUFFERED=1 | |
| ENV FLASK_APP=app.py | |
| ENV TF_CPP_MIN_LOG_LEVEL=2 | |
| # Expose the port | |
| EXPOSE 7860 | |
| # Run the application | |
| CMD ["python", "app.py"] |