-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moved neovim environment into separate docker
- Loading branch information
Showing
4 changed files
with
96 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |