Spaces:
Sleeping
Sleeping
Upload Dockerfile
Browse files8 unmodified lines9101112131415161718192021222324252627282930313233343536373839404142434445464748495051528 unmodified lineswget \git \findutils \&& rm -rf /var/lib/apt/lists/*# Set working directoryWORKDIR /app# Copy ALL files from the repositoryCOPY . .# ============================================================# BULLETPROOF ENGINE BUILD (Optimized for Deepcastle v7)# ============================================================RUN echo "Commencing Engine Build..." && \MAKE_PATH=$(find . -name "Makefile" | head -n 1) && \if [ -n "$MAKE_PATH" ]; then \MAKE_DIR=$(dirname "$MAKE_PATH"); \cd "$MAKE_DIR" && \echo "Building in $MAKE_DIR..." && \make -j$(nproc) build ARCH=x86-64-sse41-popcnt || echo "Source build failed!"; \if [ -f "stockfish" ]; then \mkdir -p /app/engine && \cp stockfish /app/engine/deepcastle; \fi; \fi# ============================================================# FAILSAFE: Linux Binary (Reliable Mirror)# ============================================================WORKDIR /app/engineRUN if [ ! -f "deepcastle" ]; then \echo "Using Failsafe: Downloading Rock-Solid Linux Release..."; \wget https://github.com/official-stockfish/Stockfish/releases/download/sf_17/stockfish-ubuntu-x86-64-sse41-popcnt.tar.xz && \tar -xvf stockfish-ubuntu-x86-64-sse41-popcnt.tar.xz && \cp stockfish/stockfish-ubuntu-x86-64-sse41-popcnt deepcastle && \rm -rf stockfish*; \fi && chmod +x deepcastle# Fallback: NNUEoptimized brainRUN if [ ! -f "output.nnue" ]; then \wget https://tests.stockfishchess.org/api/nn/nn-ae6a455a-c521-4f11-923f-5626359074df.nnue -O output.nnue; \fi8 unmodified lines910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061628 unmodified lineswget \git \findutils \curl \xz-utils \&& rm -rf /var/lib/apt/lists/*# Set working directoryWORKDIR /app# Copy ALL files from the repository (to get the NNUE and server files)COPY . .# ============================================================# GOD-TIER ENGINE BUILD (Self-Healing Source Hijack)# ============================================================# 1. Clone a fresh, clean Stockfish repository (avoids missing local scripts)RUN echo "Cloning fresh engine source..." && \git clone --depth 1 https://github.com/official-stockfish/Stockfish.git /app/clean_engine# 2. Overwrite the engine with your custom Deepcastle network (if it exists)RUN if [ -f "/app/engine/output.nnue" ]; then \echo "Successfully found custom Deepcastle NNUE. Hijacking clean source..."; \cp /app/engine/output.nnue /app/clean_engine/src/deepcastle.nnue; \fi# 3. Build the engine in the clean directory# We use ARCH=x86-64-sse41-popcnt (Very compatible with cloud)# We disable the network fetch (since we provide it)WORKDIR /app/clean_engine/srcRUN make -j$(nproc) build ARCH=x86-64-sse41-popcnt && \mkdir -p /app/engine && \cp stockfish /app/engine/deepcastle && \echo "Engine build complete!"# ============================================================# FALLBACK: Linux Binary (Alternative Mirror)# ============================================================WORKDIR /app/engineRUN if [ ! -f "deepcastle" ]; then \echo "Using Failsafe: Downloading Rock-Solid Linux Release SF 16.1..."; \wget https://github.com/official-stockfish/Stockfish/releases/download/sf_16.1/stockfish-ubuntu-x86-64-sse41-popcnt.tar.xz && \tar -xvf stockfish-ubuntu-x86-64-sse41-popcnt.tar.xz && \cp stockfish/stockfish-ubuntu-x86-64-sse41-popcnt deepcastle && \rm -rf stockfish*; \fi && chmod +x deepcastle# Ensure NNUE exists in the engine directory for runtime# (Deepcastle v7 uses output.nnue)RUN if [ ! -f "output.nnue" ]; then \echo "Brain missing. Downloading specialized NNUE..." && \wget https://tests.stockfishchess.org/api/nn/nn-ae6a455a-c521-4f11-923f-5626359074df.nnue -O output.nnue; \fi
Dockerfile+27-17