FROM greeng340or/rust-dev-ubuntu

# Install required packages for librocksdb-sys, Python, Node.js, and search tools
RUN apt-get update && apt-get install -y \
    clang \
    libclang-dev \
    llvm-dev \
    python3 \
    python3-pip \
    python3-venv \
    curl \
    lsof \
    silversearcher-ag \
    ripgrep \
    && pip3 install build pdoc twine --break-system-packages \
    && curl -fsSL https://deb.nodesource.com/setup_lts.x | bash - \
    && apt-get install -y nodejs \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/*

# Install uv (fast Python package manager)
RUN curl -LsSf https://astral.sh/uv/install.sh | sh
ENV PATH="/root/.local/bin:$PATH"


# Note: Avoid installing a specific CPython via `uv python install ...` during image build.
# Those downloads are large and can fail transiently (e.g., GitHub 5xx), breaking devcontainer builds.
# We rely on the distro-provided python3 installed above.

# Install Rust coverage tooling and TOML formatter/linter
RUN rustup component add llvm-tools-preview \
    && cargo install cargo-llvm-cov --locked \
    && cargo install cargo-machete --locked \
    && cargo install taplo-cli --locked

# Install YAML linter
RUN uv tool install yamllint

# Install Markdown linter
RUN npm install -g markdownlint-cli2

# Install Python dependencies for Qrusty integrations
COPY integrations/python/requirements.txt /tmp/requirements.txt
RUN pip3 install --break-system-packages -r /tmp/requirements.txt && rm /tmp/requirements.txt

# Install Node.js dependencies globally for Node-RED development
RUN npm install -g node-red
