Skip to content

Commit

Permalink
Moved neovim environment into separate docker
Browse files Browse the repository at this point in the history
  • Loading branch information
Midren committed Oct 20, 2021
1 parent b0c89c1 commit ecceaa8
Show file tree
Hide file tree
Showing 4 changed files with 96 additions and 12 deletions.
6 changes: 1 addition & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ RUN jupyter nbextension enable code_prettify/autopep8
RUN jupyter nbextension enable collapsible_headings/main
RUN jt -tf source -nf ptsans -nfs 10 -ofs 10 -fs 10 -tfs 10 #-t gruvboxd --vim

RUN conda install altair vega autopep8 seaborn pytorch pytorch-lightning statsmodels keras
RUN conda install altair vega autopep8 seaborn pytorch pytorch-lightning statsmodels keras neptune-client
RUN conda init bash

RUN mkdir /home/developer/ipynotebooks && \
Expand All @@ -72,7 +72,3 @@ RUN pip3 install ompython

ENV USER developer
ENV DISPLAY :0.0

USER developer

#ENTRYPOINT sudo -S service ssh restart && bash
63 changes: 63 additions & 0 deletions Dockerfile-dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
FROM jmodelica:base

USER root

RUN apt-get update -y \
&& apt install -y ca-certificates

# add newer npm
RUN curl -sL https://deb.nodesource.com/setup_16.x -o nodesource_setup.sh \
&& chmod +x nodesource_setup.sh \
&& ./nodesource_setup.sh

RUN apt-get update -y \
&& apt-get install -y software-properties-common \
&& add-apt-repository -y ppa:neovim-ppa/unstable \
&& apt-get update -y \
&& apt-get install -y sudo git lua5.1 python3-dev cmake nodejs locales \
&& apt-get install -y silversearcher-ag global clang-format ctags neovim zsh tmux \
&& apt upgrade -y \
&& apt-get clean

# install ripgrep
RUN curl -LO https://github.com/BurntSushi/ripgrep/releases/download/12.1.1/ripgrep_12.1.1_amd64.deb \
&& sudo dpkg -i ripgrep_12.1.1_amd64.deb

RUN pip3 install pynvim ranger-fm trash-cli
RUN npm install -g fixjson neovim jsonlint prettier

RUN chsh -s /bin/zsh

# set locale to support agnoster
RUN locale-gen en_US.UTF-8

RUN apt update \
&& apt install -y build-essential autoconf automake pkg-config libevent-dev libncurses5-dev bison byacc \
&& rm -rf /tmp/tmux \
&& git clone https://github.com/tmux/tmux.git /tmp/tmux \
&& cd /tmp/tmux \
&& git checkout 3.2 \
&& sh autogen.sh \
&& ./configure && make \
&& make install

USER developer

RUN git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf \
&& ~/.fzf/install --bin \
&& mkdir -p ~/.local/bin \
&& mv ~/.fzf/bin/fzf ~/.local/bin/

ADD "https://www.random.org/cgi-bin/randbyte?nbytes=10&format=h" skipcache
RUN git clone https://github.com/Midren/dotfiles ~/.dotfiles && \
~/.dotfiles/install-profile ubuntu-cli

WORKDIR /home/developer/.dotfiles

ADD "https://www.random.org/cgi-bin/randbyte?nbytes=10&format=h" skipcache
RUN git config --global user.email "[email protected]" && \
git config --global user.name "Your Name"
RUN git pull -f && \
/home/developer/.dotfiles/install-profile ubuntu-cli

ENTRYPOINT sudo -S service ssh restart && zsh
32 changes: 32 additions & 0 deletions launch.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env python3
import subprocess
import argparse
from pathlib import Path

parser = argparse.ArgumentParser(description="Launcher for project")

group = parser.add_mutually_exclusive_group(required=True)
group.add_argument("--vim", action='store_true')
group.add_argument("--jupyter", action='store_true')

args = vars(parser.parse_args())

if args['vim']:
docker = "jmodelica:dev"
startup_cmd = ["zsh"]
elif args["jupyter"]:
docker = "jmodelica:base"
startup_cmd = [
"/bin/bash", "-c", "pip3 install -e /home/developer/python_libs/ && "
"jupyter notebook --no-browser --ip=0.0.0.0 --port=8888 "
"--notebook-dir=/home/developer/ipynotebooks --matplotlib=inline"
]
else:
raise RuntimeError("Shouldn't happen")

pwd = Path(__file__).parent.resolve()
subprocess.run([
"docker", "run", "-v", f"{pwd}/python_libs:/home/developer/python_libs", "-v",
f"{pwd}/ModelicaSrc:/home/developer/modelica", "-v", f"{pwd}/notebooks:/home/developer/ipynotebooks", "-p",
"127.0.0.1:8888:8888", "-p", "127.0.0.1:6001:22", "--rm", "-it", docker, *startup_cmd
], check=True)
7 changes: 0 additions & 7 deletions launch.sh

This file was deleted.

0 comments on commit ecceaa8

Please sign in to comment.