# 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 COPY voice_feedback ./voice_feedback COPY live_test.html . # Make port available to the world outside this container # This should match the app_port in README.md and the PORT env variable 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 # Use shell form to ensure $PORT is expanded CMD exec gunicorn --worker-class eventlet -w 1 --bind "0.0.0.0:$PORT" --timeout 0 "app:app"