FROM python:3.10-slim ENV PYTHONUNBUFFERED=1 RUN apt-get update && \ apt-get install -y --no-install-recommends ffmpeg libsm6 libxext6 && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* ARG APP_USER_UID=1000 ARG APP_USER_GID=1000 RUN groupadd --gid $APP_USER_GID appgroup && \ useradd --uid $APP_USER_UID --gid appgroup --shell /bin/bash --create-home appuser WORKDIR /home/appuser/app # Upgrade pip first RUN pip install --no-cache-dir --upgrade pip # Attempt to install moviepy and key dependencies explicitly first # Adding print statements to check versions during build RUN echo "Python version: $(python --version)" && \ echo "Pip version: $(pip --version)" && \ echo "Attempting explicit MoviePy installation..." && \ pip install --no-cache-dir \ "numpy>=1.17" \ "decorator>=4.0.2" \ "proglog>=0.1.9" \ "imageio>=2.5" \ "imageio-ffmpeg>=0.4.0" \ "moviepy>=1.0.3" && \ echo "Explicit MoviePy installation attempt finished." && \ echo "Checking installed packages:" && \ pip list COPY requirements.txt ./ # Ensure requirements.txt doesn't also list moviepy if installed explicitly above # or ensure versions are compatible. For now, let's assume moviepy is *only* installed above. # If moviepy is also in requirements.txt, pip might try to reinstall or change version. RUN echo "Installing packages from requirements.txt..." && \ pip install --no-cache-dir -r requirements.txt && \ echo "Finished installing from requirements.txt." && \ echo "Final check of installed packages:" && \ pip list COPY . . RUN chown -R appuser:appgroup /home/appuser/app USER appuser EXPOSE 8501 CMD ["streamlit", "run", "app.py", "--server.headless=true"]