| # Use an official Python runtime as a parent image | |
| FROM python:3.10-slim | |
| # Set the working directory in the container | |
| WORKDIR /app | |
| # Create static folder structure (if needed by original UI, less critical for pure API) | |
| RUN mkdir -p static/images | |
| # Install system dependencies required by OpenCV and other libraries | |
| RUN apt-get update && \ | |
| apt-get install -y --no-install-recommends \ | |
| libgl1-mesa-glx \ | |
| libglib2.0-0 \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Copy the requirements file into the container at /app | |
| COPY requirements.txt . | |
| # Install any needed packages specified in requirements.txt | |
| # Ensure your requirements.txt is clean and includes gunicorn | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy the rest of the application's source code | |
| COPY app.py . | |
| COPY exercises ./exercises | |
| COPY pose_estimation ./pose_estimation | |
| COPY feedback ./feedback | |
| COPY utils ./utils | |
| COPY db ./db | |
| COPY static ./static | |
| COPY templates ./templates | |
| # Make port 8080 available to the world outside this container (Cloud Run default) | |
| EXPOSE 8080 | |
| # Define environment variable for the port | |
| ENV PORT 8080 | |
| ENV MPLCONFIGDIR /tmp/matplotlib_config_cache | |
| # Run app.py when the container launches using Gunicorn WSGI server | |
| CMD gunicorn --bind 0.0.0.0:${PORT} --workers 1 --threads 8 --timeout 0 app:app |