# Lean base image: OS, toolchains and editor only -- no AI tools.
# Tool images (aic:pi, aic:claude, ...) build FROM this.
FROM fedora:44 AS build

RUN dnf update -y \
    && dnf upgrade -y \
    && dnf install curl git -y

# Prepare neovim config files
ARG REPO_URL="https://github.com/Nicoretti/config-files.git"
ARG BRANCH="master"
ARG SUBTREE_PATH=".config/nvim"

WORKDIR /download
RUN git clone --depth 1 --branch ${BRANCH} --no-checkout --filter=blob:none ${REPO_URL} repo

WORKDIR /download/repo
RUN git sparse-checkout set "${SUBTREE_PATH}"
RUN git checkout ${BRANCH}
RUN rm -rf .git

# --- MAIN IMAGE ----------------------------------------------------------------------------------
FROM fedora:44

RUN dnf update -y \
    && dnf upgrade -y \
    && dnf install curl nodejs git -y

# Install Editor (neovim)
RUN dnf install neovim -y
COPY --from=build /download/repo/.config/nvim /root/.config/nvim
RUN nvim --headless "+Lazy! sync" +qa
ENV EDITOR="nvim"

WORKDIR /workspace
