# Use lightweight python base image FROM python:3.11-slim # Install compilation and runtime dependencies RUN apt-get update && apt-get install -y --no-install-recommends \ git \ make \ g++ \ curl \ ca-certificates \ && rm -rf /var/lib/apt/lists/* # Create and set app directory WORKDIR /app # 1. Clone lichess-bot repository directly into /app (since /app is empty, this works perfectly) RUN git clone --depth 1 https://github.com/lichess-bot-devs/lichess-bot.git . # 2. Install python requirements RUN pip install --no-cache-dir -r requirements.txt # 3. Clone and compile Stockfish with elshater77 branding, copying binary to /app/engines/ RUN git clone --depth 1 https://github.com/official-stockfish/Stockfish.git /tmp/stockfish && \ cd /tmp/stockfish/src && \ # Patch branding to elshater77 sed -i 's/id name Stockfish/id name elshater77/g' uci.cpp || true && \ sed -i 's/"Stockfish"/"elshater77"/g' engine_info.cpp || true && \ # Build engine optimized for modern standard CPUs make -j$(nproc) build ARCH=x86-64-modern && \ cp stockfish /app/engines/elshater77_engine && \ chmod +x /app/engines/elshater77_engine && \ # Clean up source files rm -rf /tmp/stockfish # Copy config template and secure launcher COPY config.yml.template /app/config.yml.template COPY start.py /app/start.py # Expose port 7860 to pass Hugging Face Spaces health checks! EXPOSE 7860 # Run secure startup script CMD ["python", "start.py"]