FROM ubuntu:22.04

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

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

# ── 1. Core System Tools, Python Dev Headers & NSIS Compiler ───────────────────
RUN apt-get update -qq && apt-get install -y -qq --no-install-recommends \
    # Basic utilities
    ca-certificates \
    curl \
    wget \
    git \
    tar \
    gzip \
    zip \
    unzip \
    # Native compilation toolchains
    build-essential \
    gcc \
    make \
    # Python 3 & dynamic shared libraries (required for PyInstaller standalone binaries)
    python3 \
    python3-pip \
    python3-venv \
    python3-dev \
    libpython3-dev \
    libffi-dev \
    libssl-dev \
    # NSIS (for compiling Windows Setup executables on Linux)
    nsis \
    nsis-common \
    nsis-pluginapi \
    && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

# ── 2. Node.js 20 LTS (required for Act / Gitea Actions runners) ───────────────
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
    && apt-get install -y -qq nodejs \
    && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

# ── 3. Pre-installed Python Build & Application Dependencies ───────────────────
RUN pip3 install --no-cache-dir \
    # Binary compiler & PE packaging tools
    pyinstaller \
    distlib \
    cryptography \
    pefile \
    cffi \
    # LOGAR core dependencies
    pgpy \
    fastapi \
    uvicorn \
    websockets \
    pydantic \
    requests \
    httpx \
    # Database drivers & ORM for multi-engine storage
    sqlalchemy \
    psycopg2-binary \
    pymysql \
    # Code quality / linter / testing
    coverage \
    flake8

WORKDIR /workspace

CMD ["/bin/bash"]
