Skip to content

Dockerfile and enhancement python package #29

@luigiberducci

Description

@luigiberducci

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:

  1. 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)
  2. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions