FROM debian:bookworm-slim

LABEL maintainer="me0nline <me0nline@eibl.tech>"
LABEL description="LOGAR CI/CD & Binary Release Cross-Compilation Runner"

ENV DEBIAN_FRONTEND=noninteractive \
    PYTHONUNBUFFERED=1 \
    LANG=C.UTF-8 \
    LC_ALL=C.UTF-8

# Install core build dependencies, NSIS compiler, and Python development packages
RUN apt-get update && apt-get install -y --no-install-recommends \
    build-essential \
    gcc \
    make \
    binutils \
    curl \
    wget \
    git \
    tar \
    gzip \
    zip \
    unzip \
    ca-certificates \
    nsis \
    nsis-common \
    nsis-pluginapi \
    python3 \
    python3-dev \
    libpython3-dev \
    python3-pip \
    python3-venv \
    python3-setuptools \
    python3-wheel \
    libffi-dev \
    libssl-dev \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

# Verify NSIS makensis binary
RUN which makensis && makensis -VERSION

# Verify Python and shared libraries
RUN python3 --version && python3 -c "import sys; print('Python sys.path:', sys.path)"

# Install PyInstaller and compilation dependencies system-wide
RUN pip3 install --no-cache-dir --break-system-packages \
    pyinstaller \
    distlib \
    cryptography \
    pefile \
    cffi \
    pgpy \
    fastapi \
    uvicorn \
    pydantic \
    requests

# Create workspace directory
WORKDIR /workspace

CMD ["/bin/bash"]
