Spaces:
Running
Running
Update Dockerfile
Browse files- Dockerfile +15 -13
Dockerfile
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 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 \
|
|
@@ -10,7 +10,6 @@ RUN apt-get update && apt-get install -y \
|
|
| 10 |
&& rm -rf /var/lib/apt/lists/*
|
| 11 |
|
| 12 |
# --- HUGGING FACE COMPLIANCE STEP ---
|
| 13 |
-
# Set up a non-root user (UID 1000) required by Hugging Face
|
| 14 |
RUN useradd -m -u 1000 user
|
| 15 |
ENV HOME=/home/user \
|
| 16 |
PATH=/home/user/.local/bin:$PATH
|
|
@@ -22,25 +21,29 @@ WORKDIR /app
|
|
| 22 |
COPY --chown=user:user . /app
|
| 23 |
|
| 24 |
# --- AUTOMATED NNUE DOWNLOAD STEP ---
|
| 25 |
-
#
|
| 26 |
RUN mkdir -p /app/fairy/nnue && \
|
| 27 |
-
# Crazyhouse NNUE
|
| 28 |
curl -L -o /app/fairy/nnue/crazyhouse.nnue "https://raw.githubusercontent.com/fairy-stockfish/nnue-networks/main/crazyhouse-8ebf84784ad2.nnue" && \
|
| 29 |
# Atomic Chess NNUE
|
| 30 |
curl -L -o /app/fairy/nnue/atomic.nnue "https://raw.githubusercontent.com/fairy-stockfish/nnue-networks/main/active-41937adf950a.nnue" && \
|
| 31 |
-
# Three-check NNUE
|
| 32 |
-
curl -L -o /app/fairy/nnue/3check.nnue "https://raw.githubusercontent.com/fairy-stockfish/nnue-networks/main/3check-cb5f517c228b.nnue"
|
| 33 |
-
|
| 34 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
RUN chmod -R 777 /app
|
| 36 |
|
| 37 |
# Step 5: Install the Python requirements
|
| 38 |
-
# We also install 'http.server' capabilities natively via python, but we need standard dependencies
|
| 39 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 40 |
|
| 41 |
# Step 6: Grant execute permission to your variant engine
|
| 42 |
-
|
| 43 |
-
RUN chmod 777 ./fairy/stockfish
|
| 44 |
|
| 45 |
# Switch to the Hugging Face restricted user
|
| 46 |
USER user
|
|
@@ -48,9 +51,8 @@ USER user
|
|
| 48 |
# Step 7: Expose Hugging Face's mandatory port
|
| 49 |
EXPOSE 7860
|
| 50 |
|
| 51 |
-
# Force Python logs to output immediately
|
| 52 |
ENV PYTHONUNBUFFERED=1
|
| 53 |
|
| 54 |
# Step 8: Start a tiny background health server AND your Lichess bot
|
| 55 |
-
# This fakes a web server on 7860 to satisfy the HF health-check, while running your bot normally.
|
| 56 |
CMD python -m http.server 7860 & python lichess-bot-master/lichess-bot.py
|
|
|
|
| 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 \
|
|
|
|
| 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
|
|
|
|
| 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
|
|
|
|
| 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 |
# Step 8: Start a tiny background health server AND your Lichess bot
|
|
|
|
| 58 |
CMD python -m http.server 7860 & python lichess-bot-master/lichess-bot.py
|