my-flask-app / Dockerfile
chemistrymath's picture
Update Dockerfile
29b9fa5 verified
Raw
History Blame Contribute Delete
1.12 kB
# Use Python 3.10 as the base image
FROM python:3.10
# Set the working directory
WORKDIR /app
# Copy application files to the container
COPY . /app
# Install system dependencies
RUN apt-get update && apt-get install -y libgl1-mesa-glx libglib2.0-0 wget fontconfig
# Create writable directories for Matplotlib, Fontconfig, and MediaPipe models
RUN mkdir -p /tmp/matplotlib && chmod 777 /tmp/matplotlib
RUN mkdir -p /tmp/fontconfig && chmod 777 /tmp/fontconfig
RUN mkdir -p /app/mediapipe_models && chmod 777 /app/mediapipe_models
# Set environment variables to fix cache-related errors
ENV MPLCONFIGDIR=/tmp/matplotlib
ENV FONTCONFIG_PATH=/tmp/fontconfig
ENV MEDIAPIPE_MODEL_PATH=/app/mediapipe_models
# Download the correct MediaPipe pose model
RUN wget -O /app/mediapipe_models/pose_landmarker_heavy.task \
https://storage.googleapis.com/mediapipe-models/pose_landmark/pose_landmarker_heavy/float16/latest/pose_landmarker_heavy.task
# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Expose the Flask app port
EXPOSE 8001
# Run the application
CMD ["python", "app.py"]