diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..2d3b1421e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,47 @@ +FROM debian:stable + +RUN apt-get update + +RUN apt-get install -y \ + virtualenv \ + python3-pip \ + python3-dev \ + git \ + build-essential \ + libasound2-dev \ + libjack-jackd2-dev \ + liblilv-dev \ + libjpeg-dev \ + zlib1g-dev \ + python2 + + +ENV LV2_PATH="/lv2" +ENV MOD_DEV_HOST=1 +ENV MOD_DEV_ENVIRONMENT=0 + +RUN mkdir /mod-lv2-data +RUN mkdir /lv2 +WORKDIR /mod-lv2-data +RUN git clone https://github.com/moddevices/mod-lv2-data.git +RUN mv mod-lv2-data/plugins-fixed/* /lv2 +RUN rm -rf mod-lv2-data + +RUN mkdir /mod-ui + +COPY ./ /mod-ui/ + +WORKDIR /mod-ui + +RUN virtualenv modui-env +RUN chmod a+x activate-env +RUN ./activate-env + +RUN pip3 install -r requirements.txt +RUN make -C utils + +EXPOSE 8888 + +VOLUME ["/lv2", "/mod-ui"] + +CMD python3 ./server.py diff --git a/README.rst b/README.rst index 2d1a3704e..f4781b1d8 100644 --- a/README.rst +++ b/README.rst @@ -12,7 +12,7 @@ It will work in x86, other Linux distributions and Mac, but you might need to ad The following packages will be required:: - $ sudo apt-get install virtualenv python3-pip python3-dev git build-essential libasound2-dev libjack-jackd2-dev liblilv-dev libjpeg-dev + $ sudo apt-get install virtualenv python3-pip python3-dev git build-essential libasound2-dev libjack-jackd2-dev liblilv-dev libjpeg-dev zlib1g-dev NOTE: libjack-jackd2-dev can be replaced by libjack-dev if you are using JACK1; libjpeg-dev is needed for python-pillow, at least on my system. @@ -58,3 +58,44 @@ And now you are ready to start the webserver:: Setting the environment variables is needed when developing on a PC. Open your browser and point to http://localhost:8888/. + +Running with docker +------------------- + +You can also run mod-ui locally using docker. + +Note that, with docker, mod-ui will run with fake connections to the host (there is no host). So no sound will be produced. + +Run docker: + +``` +docker pull moddevices/mod-ui +docker run -p 8888:8888 +``` + +Open your browser and point to http://localhost:8888/. + +There are two volumes you can mount: +* /lv2 -> the folder containing all the lv2 plugins (by default, this image brings all plugins inside plugins-fixed folder in the mod-lv2-data repository) +* /mod-ui -> the MOD UI source code (this repository) + +Using your own LV2 plugins +++++++++++++++++++++++++++ + +You can mount a volume to your LV2 plugins folder to be able to use them with the MOD UI. + +``` +docker run -p 8888:8888 -v /path-to-my-lv2-folder/lv2:/lv2 moddevices/mod-ui + +``` + +Mounting the UI source code ++++++++++++++++++++++++++++ + +If you are developing the UI, you probably want to mount the source code from your machine into docker. Doing this, you can code on your environment and see the changes working on the server inside docker: + +``` +docker run -p 8888:8888 -v /path-to-your-clone-of-this-repo/mod-ui:/mod-ui moddevices/mod-ui + +``` + diff --git a/activate-env b/activate-env new file mode 100644 index 000000000..a1d69e4ae --- /dev/null +++ b/activate-env @@ -0,0 +1,5 @@ +#!/bin/bash + +# This file is used by Dockerfile to ensure source is called from bash and not sh + +source modui-env/bin/activate