Skip to content

Instantly share code, notes, and snippets.

@danidiaz
Last active September 20, 2018 13:28
Show Gist options
  • Save danidiaz/ed1e0628825505af47ed9437fbc60058 to your computer and use it in GitHub Desktop.
Save danidiaz/ed1e0628825505af47ed9437fbc60058 to your computer and use it in GitHub Desktop.
docker + docker-compose for local Haskell development
# https://docs.docker.com/compose/overview/
# https://docs.docker.com/compose/compose-file/
# https://stackoverflow.com/questions/44284484/docker-compose-share-named-volume-between-multiple-containers
version: '3.3'
services:
haskdev:
build: .
ports:
- "22:22"
volumes:
# docker volume create hask
- type: volume
source: cabal
target: /root/.cabal
# docker volume create cabal
- type: volume
source: hask
target: /root/hask
volumes:
cabal:
hask:
from ubuntu:latest
run apt-get update && \
apt-get install -y emacs agda-mode agda-stdlib && \
apt-get install -y coq coqide && \
apt-get install -y openssh-server && \
apt-get install -y iproute2 wget curl && \
apt-get install -y bzip2 tmux git vim libgmp-dev python3 gcc libtinfo-dev zlib1g-dev xz-utils make && \
git config --global core.editor vim && \
git config --global alias.co checkout && \
git config --global alias.br branch && \
git config --global alias.ci commit && \
git config --global alias.d diff && \
git config --global alias.st status && \
git config --global pull.rebase true && \
git config --global rebase.autoStash true && \
git config --global push.default simple && \
git config --global user.name daniel && \
git config --global user.email daniel@bogusemailserver.com && \
curl -L -o /root/.tmux.conf https://raw.githubusercontent.com/danidiaz/miscellany/master/linux/.tmux.conf && \
curl -L -o /root/.vimrc https://raw.githubusercontent.com/danidiaz/miscellany/master/linux/.vimrc && \
curl -L -o /root/.ghci https://gist.githubusercontent.com/danidiaz/f824b419418ae0a4fb8c5b57f349a1aa/raw/bcb8a999cf2c94828ed514f2090326bc20faa903/.ghci && \
mkdir -p /root/.vim/pack/foo/ && \
git clone https://github.com/tpope/vim-surround.git /root/.vim/pack/foo/start/surround && \
git clone https://github.com/tpope/vim-repeat /root/.vim/pack/foo/start/repeat && \
git clone https://github.com/wellle/targets.vim.git /root/.vim/pack/foo/start/targets && \
git clone https://github.com/junegunn/fzf.git /root/.vim/pack/foo/start/fzf && \
git clone https://github.com/tpope/vim-commentary.git /root/.vim/pack/foo/start/commentary && \
git clone https://github.com/michaeljsmith/vim-indent-object.git /root/.vim/pack/foo/start/indent-object && \
git clone https://github.com/danidiaz/vim-unimpaired.git /root/.vim/pack/foo/start/vim-unimpaired && \
curl -L -o /root/ghc.tar.gz https://haskell.org/platform/download/8.2.1/haskell-platform-8.2.1-unknown-posix--core-x86_64.tar.gz && \
tar xf /root/ghc.tar.gz -C /root/ && \
cd /root/ && /root/install-haskell-platform.sh && rm -rf /root/*.tar.gz && rm /root/install-haskell-platform.sh && \
mkdir /root/.ssh && \
curl -L -o /root/.ssh/authorized_keys https://gist.githubusercontent.com/danidiaz/aeff630afd31fdfd998fe3a793cf4143/raw/b54a62a925d3b1961f5e8986e1a8eb4eb1a5b5e3/key.pub && \
mkdir /var/run/sshd && \
sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/' /etc/ssh/sshd_config && \
chmod 700 /root/.ssh && \
chmod 600 /root/.ssh/authorized_keys && \
git clone --depth 1 https://github.com/junegunn/fzf.git /root/.fzf && \
yes | /root/.fzf/install && \
mkdir -p /root/.local/bin/ && \
curl -L -o ripgrep.tar.gz https://github.com/BurntSushi/ripgrep/releases/download/0.7.1/ripgrep-0.7.1-x86_64-unknown-linux-musl.tar.gz && \
tar xvzf ripgrep.tar.gz && cp /root/ripgrep-0.7.1-x86_64-unknown-linux-musl/rg /root/.local/bin && \
rm -rf /root/*.tar.gz /root/ripgrep* && \
curl -L -o /root/ghc-8.2.2-x86_64-deb8-linux.tar.xz https://downloads.haskell.org/~ghc/8.2.2/ghc-8.2.2-x86_64-deb8-linux.tar.xz && \
cd /root/ && tar xf ghc-8.2.2-x86_64-deb8-linux.tar.xz && cd /root/ghc-8.2.2/ && ./configure --prefix=/root/.local && make install && \
cd /root/ && rm -rf /root/ghc-8.2.2/ && \
echo "PS1='\$ '" >> /root/.bashrc && \
echo "PATH=/root/.cabal/bin:\$PATH" >> /root/.profile && \
echo "PATH=/root/.local/bin:\$PATH" >> /root/.profile && \
echo "export PATH" >> /root/.profile && \
echo "export FZF_DEFAULT_COMMAND='rg --files'" >> /root/.profile && \
git clone https://github.com/ProofGeneral/PG /root/.emacs.d/lisp/PG && cd /root/.emacs.d/lisp/PG && make && \
echo "(load \"~/.emacs.d/lisp/PG/generic/proof-site\")" >> /root/.emacs && \
echo "(global-set-key (kbd \"C-c RET\") 'proof-goto-point)" >> /root/.emacs && \
cabal update && cabal install idris --with-ld=ld.gold
# https://gist.github.com/danidiaz/3e867782b5f6730135bd Dockerizing an SSH daemon service
# https://security.stackexchange.com/questions/54353/how-dangerous-might-be-publishing-a-public-key
# https://unix.stackexchange.com/questions/26047/how-to-correctly-add-a-path-to-path
# https://docs.docker.com/engine/admin/volumes/bind-mounts/#choosing-the--v-or-mount-flag
# https://github.com/junegunn/fzf#respecting-gitignore-hgignore-and-svnignore
# https://github.com/ProofGeneral/PG/issues/31
# https://gist.github.com/danidiaz/351a447231f61f2f55733408538e1b13
# https://gist.github.com/danidiaz/2f8c22f5d5b81c0d399678d5d90fa2a3
# https://gist.github.com/danidiaz/4486be84912ab71a9802
# https://gist.github.com/danidiaz/b523fb9b6602b695d793
# https://gist.github.com/danidiaz/33dda27367acc72678880625eaf04f4c
EXPOSE 22
CMD ["/usr/sbin/sshd", "-D"]
apt-get update && \
#apt-get install -y emacs agda-mode agda-stdlib && \
#apt-get install -y coq coqide && \
apt-get install -y openssh-server && \
apt-get install -y iproute2 wget curl && \
apt-get install -y bzip2 tmux git vim libgmp-dev python3 gcc libtinfo-dev zlib1g-dev xz-utils make && \
git config --global core.editor vim && \
git config --global alias.co checkout && \
git config --global alias.br branch && \
git config --global alias.ci commit && \
git config --global alias.d diff && \
git config --global alias.st status && \
git config --global pull.rebase true && \
git config --global rebase.autoStash true && \
git config --global push.default simple && \
git config --global user.name daniel && \
git config --global user.email daniel@bogusemailserver.com && \
curl -L -o /home/daniel/.tmux.conf https://raw.githubusercontent.com/danidiaz/miscellany/master/linux/.tmux.conf && \
curl -L -o /home/daniel/.vimrc https://raw.githubusercontent.com/danidiaz/miscellany/master/linux/.vimrc && \
curl -L -o /home/daniel/.ghci https://gist.githubusercontent.com/danidiaz/f824b419418ae0a4fb8c5b57f349a1aa/raw/bcb8a999cf2c94828ed514f2090326bc20faa903/.ghci && \
mkdir -p /home/daniel/.vim/pack/foo/ && \
git clone https://github.com/tpope/vim-surround.git /home/daniel/.vim/pack/foo/start/surround && \
git clone https://github.com/tpope/vim-repeat /home/daniel/.vim/pack/foo/start/repeat && \
git clone https://github.com/wellle/targets.vim.git /home/daniel/.vim/pack/foo/start/targets && \
git clone https://github.com/junegunn/fzf.git /home/daniel/.vim/pack/foo/start/fzf && \
git clone https://github.com/tpope/vim-commentary.git /home/daniel/.vim/pack/foo/start/commentary && \
git clone https://github.com/michaeljsmith/vim-indent-object.git /home/daniel/.vim/pack/foo/start/indent-object && \
git clone https://github.com/danidiaz/vim-unimpaired.git /home/daniel/.vim/pack/foo/start/vim-unimpaired && \
curl -L -o /home/daniel/ghc.tar.gz https://downloads.haskell.org/~ghc/8.4.1/ghc-8.4.1-x86_64-deb8-linux.tar.xz && \
tar xf /home/daniel/ghc.tar.gz -C /home/daniel/ && \
curl -L -o /home/daniel/cabal.tar.gz https://www.haskell.org/cabal/release/cabal-install-2.2.0.0/cabal-install-2.2.0.0-x86_64-unknown-linux.tar.gz && \
mkdir -p /home/daniel/.cabal/bin/ && \
tar xf /home/daniel/cabal.tar.gz -C /home/daniel/.cabal/bin && \
mkdir /home/daniel/.ssh && \
curl -L -o /home/daniel/.ssh/authorized_keys https://gist.githubusercontent.com/danidiaz/aeff630afd31fdfd998fe3a793cf4143/raw/b54a62a925d3b1961f5e8986e1a8eb4eb1a5b5e3/key.pub && \
chmod 700 /home/daniel/.ssh && \
chmod 600 /home/daniel/.ssh/authorized_keys && \
sudo chown -R daniel:daniel /home/daniel/.ssh/ && \
git clone --depth 1 https://github.com/junegunn/fzf.git /home/daniel/.fzf && \
yes | /home/daniel/.fzf/install && \
mkdir -p /home/daniel/.local/bin/ && \
curl -L -o ripgrep.tar.gz https://github.com/BurntSushi/ripgrep/releases/download/0.7.1/ripgrep-0.7.1-x86_64-unknown-linux-musl.tar.gz && \
tar xvzf ripgrep.tar.gz && cp /home/daniel/ripgrep-0.7.1-x86_64-unknown-linux-musl/rg /home/daniel/.local/bin && \
rm -rf /home/daniel/*.tar.gz /home/daniel/ripgrep* && \
echo "PS1='\$ '" >> /home/daniel/.bashrc && \
echo "PATH=/home/daniel/.cabal/bin:\$PATH" >> /home/daniel/.profile && \
echo "PATH=/home/daniel/.local/bin:\$PATH" >> /home/daniel/.profile && \
echo "export PATH" >> /home/daniel/.profile && \
echo "export FZF_DEFAULT_COMMAND='rg --files'" >> /home/daniel/.profile && \
chown -R daniel:daniel /home/daniel/.cabal/ && \
chown -R daniel:daniel /home/daniel/.local/ && \
sudo update-alternatives --set editor /usr/bin/vim.basic && \
cabal update
# https://gist.github.com/danidiaz/3e867782b5f6730135bd Dockerizing an SSH daemon service
# https://security.stackexchange.com/questions/54353/how-dangerous-might-be-publishing-a-public-key
# https://unix.stackexchange.com/questions/26047/how-to-correctly-add-a-path-to-path
# https://docs.docker.com/engine/admin/volumes/bind-mounts/#choosing-the--v-or-mount-flag
# https://github.com/junegunn/fzf#respecting-gitignore-hgignore-and-svnignore
# https://github.com/ProofGeneral/PG/issues/31
# https://gist.github.com/danidiaz/351a447231f61f2f55733408538e1b13
# https://gist.github.com/danidiaz/2f8c22f5d5b81c0d399678d5d90fa2a3
# https://gist.github.com/danidiaz/4486be84912ab71a9802
# https://gist.github.com/danidiaz/b523fb9b6602b695d793
# https://gist.github.com/danidiaz/33dda27367acc72678880625eaf04f4c
# https://askubuntu.com/questions/792832/how-to-install-virtualbox-guest-additions-for-ubuntu-16-04/792833
# sudo apt-get install virtualbox-guest-dkms
# sudo usermod -aG vboxsf daniel
# mkdir /home/daniel/vboxshared
# sudo mount -t vboxsf -o uid=1000,gid=1000 vboxshared /home/daniel/vboxshared
#
# pageant + putty -load "sessioname" to connect
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment