Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files2 unmodified lines345678910111213678169181910112223242526272829303132121314151617181939404120214344454647484950515253545556575859222324256226276465662829683031323334727335362 unmodified lines
# Install system dependenciesRUN apt-get update && apt-get install -y \ build-essential \ make \ g++ \ wget \ git \ findutils \ curl \ xz-utils \ 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_engine
# Build the EngineRUN 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)# ============================================================# Prepare the LauncherWORKDIR /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
# ============================================================# BACKEND SETUP# THE FIX: Added 'websockets' here# ============================================================WORKDIR /appRUN pip install fastapi "uvicorn[standard]" websockets python-chess pydantic
RUN pip install --no-cache-dir fastapi "uvicorn[standard]" python-chess pydantic websockets
# Set PYTHONPATH to include all potential source directories# Set weights and environmentENV PYTHONPATH="/app:/app/server"ENV ENGINE_PATH="/app/engine/deepcastle"EXPOSE 7860
# START: Use the guaranteed launcher in the rootCMD ["python3", "/app/launcher.py"]# THE FIX: Run with uvicorn directly for better health detectionCMD ["uvicorn", "launcher:app", "--host", "0.0.0.0", "--port", "7860"]Dockerfile+12-49