├── Dockerfile ├── .ipynb_checkpoints └── Untitled-checkpoint.ipynb ├── README.md ├── Dockerfile.image └── Untitled.ipynb /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM philzook58/jupyter-ocaml 2 | 3 | -------------------------------------------------------------------------------- /.ipynb_checkpoints/Untitled-checkpoint.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [], 3 | "metadata": {}, 4 | "nbformat": 4, 5 | "nbformat_minor": 2 6 | } 7 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ocaml_binder 2 | 3 | [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/philzook58/ocaml_binder/master) 4 | 5 | 6 | 7 | Setting up a jupyter ocaml environment for running on binder. CLick the icon above to launch 8 | 9 | `docker build --tag jupyter-ocaml Dockerfile.image` 10 | 11 | -------------------------------------------------------------------------------- /Dockerfile.image: -------------------------------------------------------------------------------- 1 | FROM ocaml/opam2:4.07 2 | 3 | # https://mybinder.readthedocs.io/en/latest/tutorials/dockerfile.html 4 | USER root 5 | RUN apt-get install -y python3-pip pkg-config 6 | 7 | RUN pip3 install --no-cache-dir notebook==5.* 8 | # USER opam 9 | # jupyter-archimedes core 10 | RUN opam depext jupyter 11 | # jupyter-archimedes core 12 | RUN opam install jupyter -y 13 | # ENV PATH="/home/opam/.local/bin:${PATH}" 14 | RUN jupyter kernelspec install --name ocaml-jupyter "$(opam config var share)/jupyter" 15 | 16 | 17 | ARG NB_USER=jovyan 18 | ARG NB_UID=1000 19 | ENV USER ${NB_USER} 20 | ENV NB_UID ${NB_UID} 21 | ENV HOME /home/opam 22 | #${NB_USER} 23 | 24 | #RUN adduser --disabled-password \ 25 | # --gecos "Default user" \ 26 | # --uid ${NB_UID} \ 27 | # ${NB_USER} 28 | RUN usermod -l ${NB_USER} opam 29 | # Make sure the contents of our repo are in ${HOME} 30 | COPY . ${HOME} 31 | USER root 32 | RUN chown -R ${NB_UID} ${HOME}/.local 33 | 34 | # remove offedning line from /etc/hosts file 35 | # RUN sed -i '2d' /etc/hosts 36 | # http://blog.jonathanargentiero.com/docker-sed-cannot-rename-etcsedl8ysxl-device-or-resource-busy/ 37 | RUN cp /etc/hosts ~/hosts.new 38 | RUN sed -i '2d' ~/hosts.new 39 | RUN cp -f ~/hosts.new /etc/hosts 40 | 41 | 42 | RUN echo "127.0.0.1 localhost \ 43 | fe00::0 ip6-localnet \ 44 | ff00::0 ip6-mcastprefix \ 45 | ff02::1 ip6-allnodes \ 46 | ff02::2 ip6-allrouters" > /etc/hosts 47 | 48 | 49 | RUN cat /etc/hosts 50 | RUN cat ~/hosts.new 51 | #RUN chown -R ${NB_UID} ${HOME}/.local} 52 | 53 | USER ${NB_USER} 54 | # ENTRYPOINT /usr/local/bin/jupyter notebook --ip=0.0.0.0 --port=8080 55 | # ENTRYPOINT ["/usr/local/bin/jupyter", "notebook" , "--ip=0.0.0.0" ,"--port=8080"] 56 | # RUN opam init -------------------------------------------------------------------------------- /Untitled.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": 1, 6 | "metadata": {}, 7 | "outputs": [ 8 | { 9 | "data": { 10 | "text/plain": [ 11 | "val x : int = 4\n" 12 | ] 13 | }, 14 | "execution_count": 1, 15 | "metadata": {}, 16 | "output_type": "execute_result" 17 | } 18 | ], 19 | "source": [ 20 | "let x = 4" 21 | ] 22 | }, 23 | { 24 | "cell_type": "code", 25 | "execution_count": 2, 26 | "metadata": {}, 27 | "outputs": [ 28 | { 29 | "ename": "error", 30 | "evalue": "compile_error", 31 | "output_type": "error", 32 | "traceback": [ 33 | "\u001b[32mFile \"[2]\", line 1, characters 5-9:\n\u001b[31mError: Unbound module Core\n\u001b[36m 1: \u001b[30mopen \u001b[4mCore\u001b[0m\n" 34 | ] 35 | } 36 | ], 37 | "source": [ 38 | "open Core" 39 | ] 40 | }, 41 | { 42 | "cell_type": "code", 43 | "execution_count": 3, 44 | "metadata": {}, 45 | "outputs": [ 46 | { 47 | "ename": "error", 48 | "evalue": "runtime_error", 49 | "output_type": "error", 50 | "traceback": [ 51 | "\u001b[31mUnknown directive `require'.\n\u001b[0m" 52 | ] 53 | } 54 | ], 55 | "source": [ 56 | "#require" 57 | ] 58 | }, 59 | { 60 | "cell_type": "code", 61 | "execution_count": 4, 62 | "metadata": {}, 63 | "outputs": [ 64 | { 65 | "name": "stdout", 66 | "output_type": "stream", 67 | "text": [ 68 | "Cannot find file topfind.\n" 69 | ] 70 | } 71 | ], 72 | "source": [ 73 | "#use \"topfind\"" 74 | ] 75 | }, 76 | { 77 | "cell_type": "code", 78 | "execution_count": null, 79 | "metadata": {}, 80 | "outputs": [], 81 | "source": [] 82 | } 83 | ], 84 | "metadata": { 85 | "kernelspec": { 86 | "display_name": "OCaml default", 87 | "language": "OCaml", 88 | "name": "ocaml-jupyter" 89 | }, 90 | "language_info": { 91 | "codemirror_mode": "text/x-ocaml", 92 | "file_extension": ".ml", 93 | "mimetype": "text/x-ocaml", 94 | "name": "OCaml", 95 | "nbconverter_exporter": null, 96 | "pygments_lexer": "OCaml", 97 | "version": "4.07.1" 98 | } 99 | }, 100 | "nbformat": 4, 101 | "nbformat_minor": 2 102 | } 103 | --------------------------------------------------------------------------------