In case someone else can benefit from it, I created a Dockerfile:
FROM ubuntu
# Install jdk and other dependencies
RUN apt update && apt install -y default-jdk git pip
ENV JAVA_HOME /usr/lib/jvm/java-11-openjdk-amd64
# Install Moonlight
WORKDIR /build
RUN git clone https://github.com/MoonLightSuite/MoonLight.git
WORKDIR /build/MoonLight
RUN ./gradlew clean
RUN ./gradlew release
ENV PYTHONPATH "${PYTHONPATH}:/build/MoonLight/distribution/python"
# Install additional requirements to run examples in python
RUN pip install --upgrade pip && pip install numpy matplotlib pyjnius pandas geopy pyDOE scipy
WORKDIR /home
CMD ["/bin/bash"]
Another thing I noticed is that there is no need to write python scripts in the MoonLight/distribution/python folder.
It is enough to:
- Add the
MoonLight/distribution/python path to the PYTHONPATH. For example from linux, just run from MoonLight/distribution/python the following command:
export PYTHONPATH=$PYTHONPATH:$(pwd)
- Modify the first 2 lines in
moonlight.py from
import jnius_config
jnius_config.set_classpath('./jar/moonlight.jar')
to
import jnius_config
import os
jnius_config.set_classpath(os.path.dirname(__file__) + '/jar/moonlight.jar')
A last note, it could be nice to create a moonlight package instead of a python file.
In this way, instead of the need of from moonlight import *, it would be enough to do import moonlight
Hope it helps!
Best
In case someone else can benefit from it, I created a Dockerfile:
Another thing I noticed is that there is no need to write python scripts in the
MoonLight/distribution/pythonfolder.It is enough to:
MoonLight/distribution/pythonpath to the PYTHONPATH. For example from linux, just run fromMoonLight/distribution/pythonthe following command:export PYTHONPATH=$PYTHONPATH:$(pwd)moonlight.pyfromto
A last note, it could be nice to create a
moonlightpackage instead of a python file.In this way, instead of the need of
from moonlight import *, it would be enough to doimport moonlightHope it helps!
Best