├── .gitignore ├── Dockerfile ├── Makefile ├── README.md ├── apt-packages.txt ├── jupyter_notebook_config.json ├── requirements.txt └── start.sh /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | FROM ubuntu:21.04 4 | 5 | # Export env settings 6 | ENV TERM=xterm 7 | ENV LANG C.UTF-8 8 | ENV DEBIAN_FRONTEND=noninteractive 9 | 10 | # Add Tini. Tini operates as a process subreaper for jupyter. This prevents 11 | # kernel crashes. 12 | ENV TINI_VERSION v0.18.0 13 | ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /usr/bin/tini 14 | RUN chmod +x /usr/bin/tini 15 | 16 | COPY apt-packages.txt /tmp/ 17 | 18 | RUN apt-get update \ 19 | && xargs -a /tmp/apt-packages.txt apt-get install -y \ 20 | && rm -rf /var/lib/apt/lists/* 21 | 22 | COPY requirements.txt /tmp/ 23 | RUN pip3 install --no-cache-dir -r /tmp/requirements.txt 24 | 25 | EXPOSE 8888 26 | 27 | RUN adduser -q --gecos "" --disabled-password mir 28 | 29 | RUN mkdir -p /notebooks 30 | 31 | VOLUME /notebooks 32 | WORKDIR /notebooks 33 | 34 | USER mir 35 | COPY --chown=mir:mir jupyter_notebook_config.json /home/mir/.jupyter/ 36 | COPY jupyter_notebook_config.json /root/.jupyter/ 37 | 38 | USER root 39 | 40 | ADD start.sh /usr/local/bin 41 | 42 | CMD ["start.sh", "tini", "-s", "--", "jupyter-notebook", "--allow-root", "--no-browser", "--port", "8888", "--ip", "0.0.0.0"] 43 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: build upload all 2 | 3 | all: build push 4 | 5 | build: 6 | docker build -t mtgupf/mir-toolbox . 7 | 8 | push: 9 | docker push mtgupf/mir-toolbox 10 | 11 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # MIR-toolbox-docker 2 | 3 | This project provides a docker image to run a jupyter notebook server with 4 | essentia, freesound-python and a set of python dependencies commonly used in 5 | Music Information Retrieval (MIR). 6 | 7 | ## Building 8 | 9 | You can build the image by running 10 | 11 | make build 12 | 13 | This will build the image and tag it as `mtgupf/mir-toolbox`. 14 | Alternatively, you can pull the latest version of the image from docker hub. 15 | 16 | ## Running 17 | 18 | Run the image with no arguments to start a Notebook server as root: 19 | 20 | docker run --rm -p 8888:8888 mtgupf/mir-toolbox 21 | 22 | You can access the notebook at http://localhost:8888, use the password **mir** 23 | to log in. 24 | 25 | If you want to access a notebook from your host machine, mount a volume pointing 26 | to `/notebooks` inside the container 27 | 28 | docker run --rm -p 8888:8888 --mount type=bind,source=$(pwd),target=/notebooks mtgupf/mir-toolbox 29 | 30 | ensure that the `source` location in the `--mount` option is an absolute path. 31 | 32 | ### Permissions 33 | 34 | On linux, running jupyter-notebook as root means that any new files that you 35 | create will be owned by root. To prevent this from happening, you can set an 36 | environment variable, `JUPYTER_USER_ID` to a UID which will be used to run 37 | the notebook in the container. You can set this to the UID of your local user: 38 | 39 | docker run --rm -e JUPYTER_USER_ID=$(id -u) -p 8888:8888 --mount type=bind,source=$(pwd),target=/notebooks mtgupf/mir-toolbox 40 | -------------------------------------------------------------------------------- /apt-packages.txt: -------------------------------------------------------------------------------- 1 | python3 2 | python3-dev 3 | python3-pip 4 | git 5 | gfortran 6 | libblas3 7 | libblas-dev 8 | liblapack3 9 | liblapack-dev 10 | libatlas-base-dev 11 | libxml2-dev 12 | libxslt1-dev 13 | libreadline8 14 | libreadline-dev 15 | build-essential 16 | libjpeg8 17 | libjpeg8-dev 18 | libfreetype6 19 | libfreetype6-dev 20 | zlib1g-dev 21 | openssl 22 | libssl-dev 23 | pkg-config 24 | libffi-dev 25 | software-properties-common 26 | apt-transport-https 27 | ca-certificates 28 | curl 29 | wget 30 | nano 31 | gosu 32 | -------------------------------------------------------------------------------- /jupyter_notebook_config.json: -------------------------------------------------------------------------------- 1 | { 2 | "NotebookApp": { 3 | "token": "mir" 4 | } 5 | } -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | numpy 2 | #numpy==1.15.4 3 | jupyter 4 | pyzmq 5 | scipy 6 | pandas 7 | matplotlib 8 | statsmodels 9 | scikit-learn 10 | seaborn 11 | nltk 12 | gensim 13 | sympy 14 | bokeh 15 | music21 16 | mido 17 | networkx 18 | requests 19 | beautifulsoup4 20 | -e git+https://github.com/MTG/freesound-python.git#egg=freesound-python 21 | -e git+https://github.com/craffel/mir_eval.git#egg=mir_eval 22 | -e git+https://github.com/MTG/pycompmusic.git#egg=pycompmusic 23 | essentia-tensorflow 24 | -------------------------------------------------------------------------------- /start.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Based on start.sh from Jupyter Hub 3 | 4 | set -e 5 | 6 | if [ $# -eq 0 ]; then 7 | cmd=bash 8 | else 9 | cmd=$* 10 | fi 11 | 12 | if [[ $(id -u) != 0 ]]; then 13 | echo Must run start.sh as root 14 | exit 1 15 | fi 16 | 17 | if [[ -v JUPYTER_USER_ID && $JUPYTER_USER_ID != 0 && -n $JUPYTER_USER_ID ]]; then 18 | echo Set mir UID to: $JUPYTER_USER_ID 19 | usermod -u $JUPYTER_USER_ID mir 20 | 21 | exec gosu mir $cmd 22 | else 23 | exec $cmd 24 | fi 25 | 26 | --------------------------------------------------------------------------------