# 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 \
    git \
    && rm -rf /var/lib/apt/lists/*

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

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

# Step 5: Fix executable permissions ONLY for the stockfish binary
RUN chmod +x /app/fairy/stockfish

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

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

# Step 8: Launch your environment
CMD python -m http.server 7860 & python lichess-bot-master/lichess-bot.py
