FROM python:3.10

WORKDIR /
ENV DISPLAY=:0
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=America/Chicago

# Install system dependencies for PyQt6 and Legion
RUN apt-get update && apt-get install -y \
    git \
    bash \
    qt6-base-dev \
    libgl1 \
    x11-apps \
    build-essential \
    && rm -rf /var/lib/apt/lists/*

RUN git clone https://github.com/Hackman238/legion.git
RUN cd legion && \
    chmod +x ./startLegion.sh && \
    chmod +x ./deps/* -R && \
    chmod +x ./scripts/* -R && \
    mkdir -p /legion/tmp
RUN cd legion && \
    pip3 install -r requirements.txt --upgrade
RUN cd legion && \
    bash ./deps/detectScripts.sh
WORKDIR /legion
CMD ["python3", "legion.py"]
