Amogh1221 commited on
Commit
30d6d09
Β·
verified Β·
1 Parent(s): 027c85a

Update Dockerfile

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