Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758# βββ Base βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββFROM python:3.12-slim# System depsRUN apt-get update && apt-get install -y \build-essential make g++ wget git curl xz-utils findutils \&& rm -rf /var/lib/apt/lists/*WORKDIR /appCOPY . .# βββ Debug listing ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββRUN echo "--- REPOSITORY CONTENT ---" && ls -R /app && echo "--------------------------"# βββ Build Stockfish ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββRUN 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-modern && \mkdir -p /app/engine && \cp stockfish /app/engine/deepcastle && \chmod +x /app/engine/deepcastle# βββ Find & place launcher ββββββββββββββββββββββββββββββββββββββββββββββββββββWORKDIR /appRUN LAUNCHER=$(find /app -name "main.py" | head -n 1) && \if [ -n "$LAUNCHER" ]; then \echo "Launcher found: $LAUNCHER"; cp "$LAUNCHER" /app/launcher.py; \else \echo "CRITICAL: main.py not found!"; exit 1; \fi# βββ NNUE files βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββRUN find /app -name "*.nnue" -exec cp {} /app/engine/custom_big.nnue \; 2>/dev/null || trueWORKDIR /app/engineRUN if [ ! -f "nn-9a0cc2a62c52.nnue" ]; then \wget -q https://tests.stockfishchess.org/api/nn/nn-9a0cc2a62c52.nnue; fi && \if [ ! -f "nn-47fc8b7fff06.nnue" ]; then \wget -q https://tests.stockfishchess.org/api/nn/nn-47fc8b7fff06.nnue; fi# βββ Python deps ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββWORKDIR /appRUN pip install --no-cache-dir \fastapi \"uvicorn[standard]" \uvloop \python-chess \pydantic \websockets# βββ Runtime config βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββENV PYTHONPATH="/app:/app/server"ENV ENGINE_PATH="/app/engine/deepcastle"ENV NNUE_PATH="/app/engine/output.nnue"EXPOSE 7860CMD ["python3", "/app/launcher.py"]123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172# 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-modern && \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 websockets# 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"]
Dockerfile+45-31