File size: 1,143 Bytes
8daf83b
 
 
 
 
 
 
 
 
 
 
 
 
262cfbc
 
 
 
 
8daf83b
262cfbc
 
8daf83b
4f4bc8a
 
 
262cfbc
8daf83b
 
f7bddf5
 
 
 
07ed62c
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# Step 1: Use an official lightweight Python image
FROM python:3.11-slim

# Step 2: Install required system utilities
RUN apt-get update && apt-get install -y \
    wget \
    tar \
    git \
    && rm -rf /var/lib/apt/lists/*

# Step 3: Set up the working directory inside the container
WORKDIR /app

# Step 4: Download and extract Stockfish 18 safely
RUN mkdir -p engines && \
    wget https://github.com/official-stockfish/Stockfish/releases/download/sf_18/stockfish-ubuntu-x86-64-avx2.tar && \
    tar -xf stockfish-ubuntu-x86-64-avx2.tar -C engines && \
    rm -rf stockfish-ubuntu-x86-64-avx2.tar

# Step 5: Copy all your repository files into the container
COPY . /app

# Step 5.5: Fix permissions for the fairy stockfish engine
RUN chmod +x /app/fairy/stockfish

# Step 6: Install the Python requirements
RUN pip install --no-cache-dir -r requirements.txt

# Step 6.5: Inform Hugging Face that we are opening port 7860
EXPOSE 7860

# Step 7: Start a dummy web server on port 7860 in the background, then launch your Lichess bot
CMD python -m http.server 7860 & python lichess-bot-master/lichess-bot.py
RUN chmod +x ./fairy/stockfish.py