BlueMoonBot commited on
Commit
167c36a
·
verified ·
1 Parent(s): 7677927

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +59 -0
Dockerfile ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Step 1: Use an official lightweight Python image
2
+ FROM python:3.11-slim
3
+
4
+ # Step 2: Install required system utilities
5
+ RUN apt-get update && apt-get install -y \
6
+ wget \
7
+ tar \
8
+ git \
9
+ curl \
10
+ && rm -rf /var/lib/apt/lists/*
11
+
12
+ # --- HUGGING FACE COMPLIANCE STEP ---
13
+ RUN useradd -m -u 1000 user
14
+ ENV HOME=/home/user \
15
+ PATH=/home/user/.local/bin:$PATH
16
+
17
+ # Step 3: Set up the working directory inside the container
18
+ WORKDIR /app
19
+
20
+ # Step 4: Copy repo files and explicitly grant ownership to our user
21
+ COPY --chown=user:user . /app
22
+
23
+ # --- AUTOMATED NNUE DOWNLOAD STEP ---
24
+ # Creating the folder and downloading the latest networks for variants
25
+ RUN mkdir -p /app/fairy/nnue && \
26
+ # Crazyhouse NNUE
27
+ curl -L -o /app/fairy/nnue/crazyhouse.nnue "https://raw.githubusercontent.com/fairy-stockfish/nnue-networks/main/crazyhouse-8ebf84784ad2.nnue" && \
28
+ # Atomic Chess NNUE
29
+ curl -L -o /app/fairy/nnue/atomic.nnue "https://raw.githubusercontent.com/fairy-stockfish/nnue-networks/main/active-41937adf950a.nnue" && \
30
+ # Three-check NNUE
31
+ curl -L -o /app/fairy/nnue/3check.nnue "https://raw.githubusercontent.com/fairy-stockfish/nnue-networks/main/3check-cb5f517c228b.nnue" && \
32
+ # King of the Hill NNUE
33
+ curl -L -o /app/fairy/nnue/koth.nnue "https://raw.githubusercontent.com/fairy-stockfish/nnue-networks/main/koth-a10c85f40398.nnue" && \
34
+ # Racing Kings NNUE
35
+ curl -L -o /app/fairy/nnue/racingkings.nnue "https://raw.githubusercontent.com/fairy-stockfish/nnue-networks/main/racingkings-608b26569108.nnue" && \
36
+ # Ensure the user owns the new NNUE files
37
+ chown -R user:user /app/fairy/nnue
38
+
39
+ # --- FIX: Permissions ---
40
+ RUN chmod -R 777 /app
41
+
42
+ # Step 5: Install the Python requirements
43
+ RUN pip install --no-cache-dir -r requirements.txt
44
+
45
+ # Step 6: Grant execute permission to your variant engine
46
+ RUN chmod +x ./fairy/stockfish
47
+
48
+ # Switch to the Hugging Face restricted user
49
+ USER user
50
+
51
+ # Step 7: Expose Hugging Face's mandatory port
52
+ EXPOSE 7860
53
+
54
+ # Force Python logs to output immediately
55
+ ENV PYTHONUNBUFFERED=1
56
+
57
+ # This creates a folder called 'www', puts an empty index file in it,
58
+ # and tells the server to only show that folder.
59
+ CMD mkdir -p www && touch www/index.html && python3 -m http.server 7860 --directory www & python3 lichess-bot-master/lichess-bot.py