FROM python:3.12-slim # Create working directory RUN mkdir -p /app && mkdir /gallery # Create and set user RUN useradd -u 1000 -d /app -UM appuser # Install ffmpeg RUN apt-get update \ && apt-get install -y ffmpeg \ && apt-get clean # Chown appuser home RUN chown -R appuser:appuser /app \ && chown -R appuser:appuser /gallery \ && chmod 750 /app \ && chmod 775 /gallery # Switch to appuser USER appuser # Set the working directory WORKDIR /app # Ensure pip RUN python -m ensurepip # Upgrade pip RUN pip install --upgrade pip # Install requirements COPY requirements.txt /app/requirements.txt RUN pip install -r /app/requirements.txt # Copy the sort.py file to the working directory COPY sort.py /app/sort.py VOLUME /gallery # Set the entry point to sort.py ENTRYPOINT ["python", "/app/sort.py"]