blob: 6332dae2a8a87651c4b772907e4efba4eb453058 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
.. _docker:
Running in docker
=================
Running the system in docker has many advantages:
* Don't have to worry about getting dependencies- the system requires many libraries to be avaliable on the PATH
* Isolation: we are running remote code supplied by anyone, which can potentially be very dangerous. Docker isolates the dangerous code, a significant security concern
* Makes the system be able to be used in Windows- Smarker has been tested in docker for windows using WSL for the backend
.. warning::
If using windows, I recommend using the mingw shell since powershell is bad at dealing with relative file paths. With mingw you can simply use ``$(pwd)``.
However, if you do, be sure to **escape file paths properly**; since, for example, ``/tmp/`` will automatically be expanded to ``C:/Users/<user>/AppData/Local/Temp/``. This causes issues when
setting up docker volumes. You can prefix your commands with ``MSYS_NO_PATHCONV=1`` (`see the documentation <https://web.archive.org/web/20201112005258/http://www.mingw.org/wiki/Posix_path_conversion>`_).
Using docker
------------
We have a ``Dockerfile`` ready for use: ``sudo docker build -t smarker .``
To input files and get the output report we use docker volumes ``-v``. Unfortunately
docker seems to be rather buggy passing through single files, so we recommend making
a directory to pass through instead.
Command line arguments can be replaced with environment variables, using the ``-e``
flag in a ``key=value`` format. There is the additional environment variable ``SMARKERDEPS``
which will pip install pypi modules at the start, deliminated with commas.
.. code-block:: bash
sudo docker run \
-v "$(pwd)/../wsData.txt":/wsData.txt \
-v "$(pwd)/100301654.zip":/tmp/100301654.zip \
-v "$(pwd)/out/":/out/ \
-e submission=/tmp/100301654.zip \
-e assessment=example \
-e SMARKERDEPS=matplotlib \
-e format=pdf \
-e output=/out/100301654.pdf \
--rm smarker
To list assessments in the database using docker:
.. code-block:: bash
sudo docker run -it --entrypoint python --rm smarker assessments.py --list yes
.. code-block:: bash
touch out/report.pickle && sudo docker run -v "$(pwd)/out/report.pickle":/Smarker/plagarism_report_details.pickle -it --entrypoint python --rm smarker assessments.py --plagarism_report example
If a file doesn't exist before it's passed through as a volume in docker, it will be created automatically as a *directory*- this causes issues if the docker image produces a file so we make a blank file first.
|