FROM ubuntu:22.04


#
# General boiler plate
#


# Ready image for installation

ARG DEBIAN_FRONTEND=noninteractive

RUN apt update -y && apt upgrade -y

# Install generic dependencies

RUN apt install git python3 python3-pip -y

#
# Install neovim 
#


# Install neovim

WORKDIR /tmp
RUN git clone https://github.com/neovim/neovim.git
WORKDIR /tmp/neovim
RUN git checkout stable
RUN apt install ninja-build gettext cmake unzip curl -y
RUN make CMAKE_BUILD_TYPE=Release -j `nproc` && make install
WORKDIR /

# Install package dependencies

RUN python3 -m pip install pynvim                                                              # python3 provider
RUN python3 -m pip install jupytext                                                            # jupytext requirements
RUN apt install fd-find ripgrep -y                                                             # Telescope requirements
RUN apt install fonts-powerline -y                                                             # vim-airline requirements
RUN python3 -m pip install neovim-remote                                                       # vimtex requirements
RUN apt install curl -y                                                                        # vim-doge requirements
RUN apt install npm python3-venv luarocks -y                                                   # mason build requirements
RUN python3 -m pip install cairosvg pnglatex plotly kaleido pyperclip jupyter-client ipykernel # molten requirements

# Configure

RUN mkdir -p /root/.config/nvim
COPY . /root/.config/nvim
RUN nvim --headless "+Lazy! sync" +qa
RUN nvim --headless "+MasonInstall clangd pyright cmake-language-server bash-language-server texlab clang-format latexindent luaformatter mdformat autopep8" +qa
RUN nvim --headless "+TSInstallSync markdown" +qa  # For some reason, without this markdown installation fails the first time

