Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files123456789910101112131415161718192018192021212223232425262725262728293031282930313233343536373338394036373839404142434445464748495041424344454647484950515253545556545556575859606162636465666759686970# Use Python 3.12 slimFROM python:3.12-slim
# Install system dependenciesRUN apt-get update && apt-get install -y \ build-essential \ make \ g++ \ wget \ git \ findutils \ curl \ xz-utils \ findutils \ stockfish \ && rm -rf /var/lib/apt/lists/*
# Set working directoryWORKDIR /app
# Copy ALL files from the repositoryCOPY . .# DEBUG: List all files to see what actually arrived from GitHubRUN echo "--- REPOSITORY CONTENT DEBUG ---" && \ ls -R /app && \ echo "---------------------------------"
# ============================================================# DUAL-BRAIN ENGINE BUILD# CUSTOM DEEPCASTLE ENGINE BUILD# Supports both repo layouts:# 1) /app/engine/src (full repo)# 2) /app/src (HF minimal repo)# ============================================================RUN echo "Cloning fresh engine source..." && \ git clone --depth 1 https://github.com/official-stockfish/Stockfish.git /app/clean_engineWORKDIR /app/clean_engine/srcRUN make -j$(nproc) build ARCH=x86-64-sse41-popcnt && \ mkdir -p /app/engine && \ cp stockfish /app/engine/deepcastle && \ chmod +x /app/engine/deepcastleRUN if [ -d /app/engine/src ]; then BUILD_DIR=/app/engine/src; \ elif [ -d /app/src ]; then BUILD_DIR=/app/src; \ else echo "Engine source dir not found"; exit 1; fi && \ cd "$BUILD_DIR" && \ make -j$(nproc) ARCH=x86-64-modern && \ mkdir -p /app/engine_bin && \ cp stockfish /app/engine_bin/deepcastle && \ chmod +x /app/engine_bin/deepcastle
# ============================================================# LAUNCHER PREPARATION (The Search & Destroy Fix)# LAUNCHER PREPARATION# ============================================================WORKDIR /appRUN echo "Searching for Launcher (main.py)..." && \ LAUNCHER_PATH=$(find /app -name "main.py" | head -n 1) && \ if [ -n "$LAUNCHER_PATH" ]; then \ echo "Found launcher at: $LAUNCHER_PATH. Copying to root..."; \ cp "$LAUNCHER_PATH" /app/launcher.py; \ else \ echo "CRITICAL ERROR: main.py not found in the repository!"; \ exit 1; \ fi# Map any NNUE files found in the repoRUN find /app -name "*.nnue" -exec cp {} /app/engine/custom_big.nnue \; || echo "No custom NNUE found."# Failsafe BrainsWORKDIR /app/engineRUN if [ ! -f "nn-9a0cc2a62c52.nnue" ]; then wget https://tests.stockfishchess.org/api/nn/nn-9a0cc2a62c52.nnue; fi && \ if [ ! -f "nn-47fc8b7fff06.nnue" ]; then wget https://tests.stockfishchess.org/api/nn/nn-47fc8b7fff06.nnue; fiRUN LAUNCHER_PATH=$(find /app -name "main.py" | head -n 1) && \ cp "$LAUNCHER_PATH" /app/launcher.py
# ============================================================# BRAIN PLACEMENT# ============================================================# Map your custom brains for the serverRUN if [ -f /app/output.nnue ]; then cp /app/output.nnue /app/engine_bin/output.nnue; fi && \ if [ -f /app/small_output.nnue ]; then cp /app/small_output.nnue /app/engine_bin/small_output.nnue; fi
# Force permissionsRUN chmod -R 777 /app/engine_bin
# ============================================================# BACKEND SETUP# ============================================================WORKDIR /appRUN pip install --no-cache-dir fastapi uvicorn python-chess pydantic# Set PYTHONPATH to include all potential source directoriesRUN pip install --no-cache-dir fastapi uvicorn chess==1.11.2 pydantic
# Explicit PathsENV ENGINE_PATH=/app/engine_bin/deepcastleENV DEEPCASTLE_ENGINE_PATH=/app/engine_bin/deepcastleENV STOCKFISH_ENGINE_PATH=/usr/games/stockfishENV NNUE_PATH=/app/engine_bin/output.nnueENV NNUE_SMALL_PATH=/app/engine_bin/small_output.nnueENV PYTHONPATH="/app:/app/server"
EXPOSE 7860# START: Use the guaranteed launcher in the root
# STARTCMD ["python3", "/app/launcher.py"]Dockerfile+44-34