From b8cd85b1d774fdb068793b160348df96dcdbf86c Mon Sep 17 00:00:00 2001 From: Flaminia Date: Mon, 29 Jul 2024 19:08:36 +0200 Subject: [PATCH] build: add dockerfile and .dockerignore --- .dockerignore | 12 ++++++++++++ Dockerfile | 20 ++++++++++++++++++++ README.md | 18 +++++++++++++++++- 3 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 .dockerignore create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..42934a1 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,12 @@ +.ipynb_checkpoints/ +__pycache__ +*.pyc +*.pyo +*.pyd +env/ +venv/ +.idea/ +.vscode/ +*.git +*.gitignore +.DS_Store \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..10d4869 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,20 @@ +# Use an official Python runtime as a parent image +FROM python:3.9-slim + +# Set the working directory in the container +WORKDIR /app + +# Copy the current directory contents into the container at /app +COPY . /app + +# Install any needed packages specified in requirements.txt +RUN pip install --no-cache-dir -r requirements.txt + +# Install the package +RUN pip install . + +# Make port 80 available to the world outside this container +EXPOSE 80 + +# Run the command to start your package +CMD ["python3", "-m", "mcda.mcda_run", "-c", "configuration.json"] \ No newline at end of file diff --git a/README.md b/README.md index 48f57ee..a4f8b15 100644 --- a/README.md +++ b/README.md @@ -209,7 +209,7 @@ pip install -r requirements.txt The Python version should de 3.9 or higher. ### Running ProMCDA -From the root dir, +From the root dir, via command line - on Windows: ```bash activate.bat @@ -222,6 +222,22 @@ python3 -m mcda.mcda_run -c configuration.json ``` where an example of configuration file can be found in `./configuration.json`. +We tested ProMCDA on Windows, Linux and Mac. We identified a possible issue with some Windows machines caused by the +library ```kaleido``` (used to generate static images) and reported [here](https://github.com/plotly/Kaleido/issues/126). +If you are experiencing any unexpected behavior of the package, we provide to you also the possibility to run it via Docker. + +First, build the docker image: +```bash +docker build -t . +``` + +Then, run the Docker container: +```bash +docker run -p 4000:80 +``` + +Change the configuration file for your needs. + ### Running the tests ```bash python3 -m pytest -s tests/unit_tests -vv