Amogh1221 commited on
Commit
11cac2d
·
1 Parent(s): 3ed6de8

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +44 -34
Dockerfile CHANGED
@@ -1,60 +1,70 @@
1
  # Use Python 3.12 slim
2
  FROM python:3.12-slim
 
3
  # Install system dependencies
4
  RUN apt-get update && apt-get install -y \
5
  build-essential \
6
  make \
7
  g++ \
8
  wget \
9
- git \
10
- findutils \
11
  curl \
12
  xz-utils \
 
 
13
  && rm -rf /var/lib/apt/lists/*
 
14
  # Set working directory
15
  WORKDIR /app
 
16
  # Copy ALL files from the repository
17
  COPY . .
18
- # DEBUG: List all files to see what actually arrived from GitHub
19
- RUN echo "--- REPOSITORY CONTENT DEBUG ---" && \
20
- ls -R /app && \
21
- echo "---------------------------------"
22
  # ============================================================
23
- # DUAL-BRAIN ENGINE BUILD
 
 
 
24
  # ============================================================
25
- RUN echo "Cloning fresh engine source..." && \
26
- git clone --depth 1 https://github.com/official-stockfish/Stockfish.git /app/clean_engine
27
- WORKDIR /app/clean_engine/src
28
- RUN make -j$(nproc) build ARCH=x86-64-sse41-popcnt && \
29
- mkdir -p /app/engine && \
30
- cp stockfish /app/engine/deepcastle && \
31
- chmod +x /app/engine/deepcastle
 
 
32
  # ============================================================
33
- # LAUNCHER PREPARATION (The Search & Destroy Fix)
34
  # ============================================================
35
  WORKDIR /app
36
- RUN echo "Searching for Launcher (main.py)..." && \
37
- LAUNCHER_PATH=$(find /app -name "main.py" | head -n 1) && \
38
- if [ -n "$LAUNCHER_PATH" ]; then \
39
- echo "Found launcher at: $LAUNCHER_PATH. Copying to root..."; \
40
- cp "$LAUNCHER_PATH" /app/launcher.py; \
41
- else \
42
- echo "CRITICAL ERROR: main.py not found in the repository!"; \
43
- exit 1; \
44
- fi
45
- # Map any NNUE files found in the repo
46
- RUN find /app -name "*.nnue" -exec cp {} /app/engine/custom_big.nnue \; || echo "No custom NNUE found."
47
- # Failsafe Brains
48
- WORKDIR /app/engine
49
- RUN if [ ! -f "nn-9a0cc2a62c52.nnue" ]; then wget https://tests.stockfishchess.org/api/nn/nn-9a0cc2a62c52.nnue; fi && \
50
- if [ ! -f "nn-47fc8b7fff06.nnue" ]; then wget https://tests.stockfishchess.org/api/nn/nn-47fc8b7fff06.nnue; fi
51
  # ============================================================
52
  # BACKEND SETUP
53
  # ============================================================
54
- WORKDIR /app
55
- RUN pip install --no-cache-dir fastapi uvicorn python-chess pydantic
56
- # Set PYTHONPATH to include all potential source directories
 
 
 
 
 
57
  ENV PYTHONPATH="/app:/app/server"
 
58
  EXPOSE 7860
59
- # START: Use the guaranteed launcher in the root
 
60
  CMD ["python3", "/app/launcher.py"]
 
1
  # Use Python 3.12 slim
2
  FROM python:3.12-slim
3
+
4
  # Install system dependencies
5
  RUN apt-get update && apt-get install -y \
6
  build-essential \
7
  make \
8
  g++ \
9
  wget \
 
 
10
  curl \
11
  xz-utils \
12
+ findutils \
13
+ stockfish \
14
  && rm -rf /var/lib/apt/lists/*
15
+
16
  # Set working directory
17
  WORKDIR /app
18
+
19
  # Copy ALL files from the repository
20
  COPY . .
21
+
 
 
 
22
  # ============================================================
23
+ # CUSTOM DEEPCASTLE ENGINE BUILD
24
+ # Supports both repo layouts:
25
+ # 1) /app/engine/src (full repo)
26
+ # 2) /app/src (HF minimal repo)
27
  # ============================================================
28
+ RUN if [ -d /app/engine/src ]; then BUILD_DIR=/app/engine/src; \
29
+ elif [ -d /app/src ]; then BUILD_DIR=/app/src; \
30
+ else echo "Engine source dir not found"; exit 1; fi && \
31
+ cd "$BUILD_DIR" && \
32
+ make -j$(nproc) ARCH=x86-64-modern && \
33
+ mkdir -p /app/engine_bin && \
34
+ cp stockfish /app/engine_bin/deepcastle && \
35
+ chmod +x /app/engine_bin/deepcastle
36
+
37
  # ============================================================
38
+ # LAUNCHER PREPARATION
39
  # ============================================================
40
  WORKDIR /app
41
+ RUN LAUNCHER_PATH=$(find /app -name "main.py" | head -n 1) && \
42
+ cp "$LAUNCHER_PATH" /app/launcher.py
43
+
44
+ # ============================================================
45
+ # BRAIN PLACEMENT
46
+ # ============================================================
47
+ # Map your custom brains for the server
48
+ RUN if [ -f /app/output.nnue ]; then cp /app/output.nnue /app/engine_bin/output.nnue; fi && \
49
+ if [ -f /app/small_output.nnue ]; then cp /app/small_output.nnue /app/engine_bin/small_output.nnue; fi
50
+
51
+ # Force permissions
52
+ RUN chmod -R 777 /app/engine_bin
53
+
 
 
54
  # ============================================================
55
  # BACKEND SETUP
56
  # ============================================================
57
+ RUN pip install --no-cache-dir fastapi uvicorn chess==1.11.2 pydantic
58
+
59
+ # Explicit Paths
60
+ ENV ENGINE_PATH=/app/engine_bin/deepcastle
61
+ ENV DEEPCASTLE_ENGINE_PATH=/app/engine_bin/deepcastle
62
+ ENV STOCKFISH_ENGINE_PATH=/usr/games/stockfish
63
+ ENV NNUE_PATH=/app/engine_bin/output.nnue
64
+ ENV NNUE_SMALL_PATH=/app/engine_bin/small_output.nnue
65
  ENV PYTHONPATH="/app:/app/server"
66
+
67
  EXPOSE 7860
68
+
69
+ # START
70
  CMD ["python3", "/app/launcher.py"]