Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960# 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 \&& 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# ============================================================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/deepcastle# ============================================================# LAUNCHER PREPARATION (The Search & Destroy Fix)# ============================================================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; fi# ============================================================# BACKEND SETUP# ============================================================WORKDIR /appRUN pip install --no-cache-dir fastapi uvicorn python-chess pydantic# Set PYTHONPATH to include all potential source directoriesENV PYTHONPATH="/app:/app/server"EXPOSE 7860# START: Use the guaranteed launcher in the rootCMD ["python3", "/app/launcher.py"]12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970# Use Python 3.12 slimFROM python:3.12-slim# Install system dependenciesRUN apt-get update && apt-get install -y \build-essential \make \g++ \wget \curl \xz-utils \findutils \stockfish \&& rm -rf /var/lib/apt/lists/*# Set working directoryWORKDIR /app# Copy ALL files from the repositoryCOPY . .# ============================================================# CUSTOM DEEPCASTLE ENGINE BUILD# Supports both repo layouts:# 1) /app/engine/src (full repo)# 2) /app/src (HF minimal repo)# ============================================================RUN 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# ============================================================WORKDIR /appRUN 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# ============================================================RUN 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# STARTCMD ["python3", "/app/launcher.py"]
Dockerfile+44-34