FROM python:3.10-slim # Install Stockfish as root RUN apt-get update && apt-get install -y stockfish curl && rm -rf /var/lib/apt/lists/* # Create a non-root user and set up the working directory RUN useradd -m -u 1000 user USER user ENV HOME=/home/user \ PATH=/home/user/.local/bin:/usr/games:$PATH WORKDIR $HOME/app # Copy files and ensure the 'user' owns them COPY --chown=user . . RUN pip install --no-cache-dir -r requirements.txt # Explicitly find and export Stockfish path RUN chmod +x setup.sh CMD ["./setup.sh"]