summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Dockerfile3
-rw-r--r--README.md4
-rw-r--r--Smarker/misc_classes.py1
-rw-r--r--Smarker/smarker.py10
4 files changed, 15 insertions, 3 deletions
diff --git a/Dockerfile b/Dockerfile
index b688e0c..d6188ee 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -7,5 +7,6 @@ RUN apt-get install -y python3-pip python3-dev build-essential texlive-base wkht
COPY ./Smarker /Smarker
WORKDIR /Smarker
RUN pip3 install -r requirements.txt
-ENTRYPOINT ["python3"]
+RUN ln -s /usr/bin/python3 /usr/bin/python
+ENTRYPOINT ["python"]
CMD ["smarker.py"] \ No newline at end of file
diff --git a/README.md b/README.md
index 43036e2..391e73b 100644
--- a/README.md
+++ b/README.md
@@ -1,2 +1,6 @@
# Smarker
An automated marking system for UEA programming assessments
+
+## Running in docker
+
+`sudo docker run -v "$(pwd)/../wsData.txt":/wsData.txt -v "$(pwd)/ExampleAssessments/CMP-4009B.yml":/tmp/CMP-4009.yml -v "$(pwd)/../ExampleSubmissions/123456789.zip":/tmp/123456789.zip -e submission=/tmp/123456789.zip -e assessment=/tmp/CMP-4009.yml -e SMARKERDEPS=matplotlib smarker`
diff --git a/Smarker/misc_classes.py b/Smarker/misc_classes.py
index 17ad36a..7ab37de 100644
--- a/Smarker/misc_classes.py
+++ b/Smarker/misc_classes.py
@@ -20,6 +20,7 @@ latex_jinja_env = jinja2.Environment(
loader = jinja2.FileSystemLoader(os.path.abspath(os.path.join(os.path.split(__file__)[0], "templates")))
)
+# https://stackoverflow.com/questions/10551117/setting-options-from-environment-variables-when-using-argparse
class EnvDefault(argparse.Action):
def __init__(self, envvar, required=True, default=None, **kwargs):
if not default and envvar:
diff --git a/Smarker/smarker.py b/Smarker/smarker.py
index 106d426..46feb5f 100644
--- a/Smarker/smarker.py
+++ b/Smarker/smarker.py
@@ -72,7 +72,7 @@ if __name__ == "__main__":
action = misc_classes.EnvDefault,
envvar = "assessment",
help = "Path to an assessment .yml file",
- type = os.path.abspath,
+ # type = os.path.abspath,
required = True
)
parser.add_argument(
@@ -80,7 +80,7 @@ if __name__ == "__main__":
action = misc_classes.EnvDefault,
envvar = "submission",
help = "Path to a zip of a student's code",
- type = os.path.abspath,
+ # type = os.path.abspath,
required = True
)
parser.add_argument(
@@ -110,6 +110,12 @@ if __name__ == "__main__":
help = "Optional argument inherited from config file. Read smarker.conf for details."
)
+ try:
+ for dependency in os.environ["SMARKERDEPS"].split(","):
+ subprocess.run(["pip", "install", dependency])
+ except KeyError:
+ pass
+
args = vars(parser.parse_args())
main(**args)
\ No newline at end of file