bodybuilding-pose-app / Dockerfile
Sean Carnahan
Fix internal server error: Add memory management and improve error handling
e2839df
raw
history blame
1.06 kB
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 model file first
COPY external/BodybuildingPoseClassifier/bodybuilding_pose_classifier.h5 /code/external/BodybuildingPoseClassifier/
# Copy the rest of the application
COPY . .
# 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"]