From a93b289cbab0538823639ff06ffcffa2fff93ac7 Mon Sep 17 00:00:00 2001 From: Stochastica Date: Sun, 21 Feb 2021 13:07:00 -0500 Subject: [PATCH] Add ocaml image and move all images to images/ --- .../hub-jupyter-spark}/Dockerfile | 0 .../jupyter_notebook_config.py | 0 .../hub-jupyter}/Dockerfile | 0 .../hub-jupyter}/jupyter_notebook_config.py | 0 {latex => images/latex}/Dockerfile | 0 {bin => images/latex}/latex-runtime.sh | 0 {bin => images/latex}/latexmk | 0 {bin => images/latex}/pdflatex | 0 images/ocaml-merlin/Dockerfile | 23 ++++++++++++++++ images/ocaml-merlin/ocaml-exec.sh | 6 +++++ images/ocaml-merlin/ocaml-runtime.sh | 27 +++++++++++++++++++ images/ocaml-merlin/ocamlmerlin | 1 + images/ocaml-merlin/opam | 1 + {route => images/route}/Dockerfile | 0 {route => images/route}/sshd_config | 0 {route => images/route}/start.sh | 0 symlinks-bin.sh | 8 +++--- 17 files changed, 62 insertions(+), 4 deletions(-) rename {hub-jupyter-spark => images/hub-jupyter-spark}/Dockerfile (100%) rename {hub-jupyter-spark => images/hub-jupyter-spark}/jupyter_notebook_config.py (100%) rename {hub-jupyter => images/hub-jupyter}/Dockerfile (100%) rename {hub-jupyter => images/hub-jupyter}/jupyter_notebook_config.py (100%) rename {latex => images/latex}/Dockerfile (100%) rename {bin => images/latex}/latex-runtime.sh (100%) rename {bin => images/latex}/latexmk (100%) rename {bin => images/latex}/pdflatex (100%) create mode 100644 images/ocaml-merlin/Dockerfile create mode 100755 images/ocaml-merlin/ocaml-exec.sh create mode 100755 images/ocaml-merlin/ocaml-runtime.sh create mode 120000 images/ocaml-merlin/ocamlmerlin create mode 120000 images/ocaml-merlin/opam rename {route => images/route}/Dockerfile (100%) rename {route => images/route}/sshd_config (100%) rename {route => images/route}/start.sh (100%) diff --git a/hub-jupyter-spark/Dockerfile b/images/hub-jupyter-spark/Dockerfile similarity index 100% rename from hub-jupyter-spark/Dockerfile rename to images/hub-jupyter-spark/Dockerfile diff --git a/hub-jupyter-spark/jupyter_notebook_config.py b/images/hub-jupyter-spark/jupyter_notebook_config.py similarity index 100% rename from hub-jupyter-spark/jupyter_notebook_config.py rename to images/hub-jupyter-spark/jupyter_notebook_config.py diff --git a/hub-jupyter/Dockerfile b/images/hub-jupyter/Dockerfile similarity index 100% rename from hub-jupyter/Dockerfile rename to images/hub-jupyter/Dockerfile diff --git a/hub-jupyter/jupyter_notebook_config.py b/images/hub-jupyter/jupyter_notebook_config.py similarity index 100% rename from hub-jupyter/jupyter_notebook_config.py rename to images/hub-jupyter/jupyter_notebook_config.py diff --git a/latex/Dockerfile b/images/latex/Dockerfile similarity index 100% rename from latex/Dockerfile rename to images/latex/Dockerfile diff --git a/bin/latex-runtime.sh b/images/latex/latex-runtime.sh similarity index 100% rename from bin/latex-runtime.sh rename to images/latex/latex-runtime.sh diff --git a/bin/latexmk b/images/latex/latexmk similarity index 100% rename from bin/latexmk rename to images/latex/latexmk diff --git a/bin/pdflatex b/images/latex/pdflatex similarity index 100% rename from bin/pdflatex rename to images/latex/pdflatex diff --git a/images/ocaml-merlin/Dockerfile b/images/ocaml-merlin/Dockerfile new file mode 100644 index 0000000..3919bac --- /dev/null +++ b/images/ocaml-merlin/Dockerfile @@ -0,0 +1,23 @@ +ARG OPAM_VERSION="4.10" +FROM ocaml/opam2:$OPAM_VERSION +ARG OPAM_VERSION + +USER root +RUN apt-get update && apt-get install -y \ + m4 +ENV USER "opam" +USER $USER +ENV OPAM_SWITCH_PREFIX="/home/$USER/.opam/${OPAM_VERSION}" +ENV PATH="$OPAM_SWITCH_PREFIX/bin:$PATH" + ENV CAML_LD_LIBRARY_PATH="$OPAM_SWITCH_PREFIX/lib/stublibs:$OPAM_SWITCH_PREFIX/lib/ocaml/stublibs:$OPAM_SWITCH_PREFIX/lib/ocaml" +ENV OCAML_TOPLEVEL_PATH="$OPAM_SWITCH_PREFIX/lib/toplevel" +ENV MANPATH=":$OPAM_SWITCH_PREFIX/man" +# Build system +RUN opam update && opam upgrade && opam install \ + cohttp \ + landmarks \ + merlin \ + ocamlgraph \ + ocamlformat + +ENV TERM=xterm-256color diff --git a/images/ocaml-merlin/ocaml-exec.sh b/images/ocaml-merlin/ocaml-exec.sh new file mode 100755 index 0000000..041d879 --- /dev/null +++ b/images/ocaml-merlin/ocaml-exec.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +script=$(basename $0) + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +$DIR/run-in-docker "$script" ${@} <&0 \ No newline at end of file diff --git a/images/ocaml-merlin/ocaml-runtime.sh b/images/ocaml-merlin/ocaml-runtime.sh new file mode 100755 index 0000000..8625648 --- /dev/null +++ b/images/ocaml-merlin/ocaml-runtime.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +set -euo pipefail + +DOCKER_NAME="ocaml-merlin" +OCAML_BIN_OUT="~/common/images/ocaml-merlin" + +# Transforms directories to internal directories for ocaml +function transform_stdin { + sed -e "s!$DIR!/data!g" +} +function transform_stdout { + sed -e "s!/data!$DIR!g" | sed -e "s!/home/opam/.opam/.*/bin!$OCAML_BIN_OUT!g" +} + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )"/.. && pwd )" +ARGS=${@} +ARGS=$(echo ${ARGS} | transform_stdin) + + +if [ -t 0 ] ; +then + docker exec -it $NAME ${ARGS} ; +else + # Replace any in-container filenames with host filesnames (stdout + stderr) + { cat <&0 | transform_stdin | docker exec -i $NAME ${ARGS} 2>&1 1>&3 3>&- | transform_stdout; } 3>&1 1>&2 | transform_stdout +fi diff --git a/images/ocaml-merlin/ocamlmerlin b/images/ocaml-merlin/ocamlmerlin new file mode 120000 index 0000000..1c66255 --- /dev/null +++ b/images/ocaml-merlin/ocamlmerlin @@ -0,0 +1 @@ +./ocaml-exec.sh \ No newline at end of file diff --git a/images/ocaml-merlin/opam b/images/ocaml-merlin/opam new file mode 120000 index 0000000..1c66255 --- /dev/null +++ b/images/ocaml-merlin/opam @@ -0,0 +1 @@ +./ocaml-exec.sh \ No newline at end of file diff --git a/route/Dockerfile b/images/route/Dockerfile similarity index 100% rename from route/Dockerfile rename to images/route/Dockerfile diff --git a/route/sshd_config b/images/route/sshd_config similarity index 100% rename from route/sshd_config rename to images/route/sshd_config diff --git a/route/start.sh b/images/route/start.sh similarity index 100% rename from route/start.sh rename to images/route/start.sh diff --git a/symlinks-bin.sh b/symlinks-bin.sh index 86992b3..aca4255 100755 --- a/symlinks-bin.sh +++ b/symlinks-bin.sh @@ -1,11 +1,11 @@ #!/bin/bash # Calculate directory relative to $HOME -COMMON_BIN=$PWD/bin +IMAGES=$PWD/images/latex/bin LOCAL_BIN=/usr/local/bin pushd $LOCAL_BIN >> /dev/null -ln -vs $COMMON_BIN/latex-runtime.sh . -ln -vs $COMMON_BIN/latexmk . -ln -vs $COMMON_BIN/pdflatex . +ln -vs $IMAGES/latex/bin/latex-runtime.sh . +ln -vs $IMAGES/latex/bin/latexmk . +ln -vs $IMAGES/latex/bin/pdflatex . popd >> /dev/null