diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000000000000000000000000000000000000..859a472553a7780d544107072f59c1d1e242724a --- /dev/null +++ b/.dockerignore @@ -0,0 +1,5 @@ +.venv +.vscode +.gitignore +docker-compose.yml +gradingscript.Dockerfile \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000000000000000000000000000000000000..173ed61f91afd3cdf6f77b3acdd5dd2507c06b11 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,12 @@ +services: + app: + image: gradingscript:latest + build: + context: . + dockerfile: ./gradingscript.dockerfile + environment: + ASSIGNMENT_TITLE: "Assignment Title" + SCORE_DEFAULT: 100 + LATE_PENALTY: 8 + DEFAULT_POINTS: "[[10],[15,20],[0]]" + DEFAULT_LABELS: "['Name', 'Steps', 'Extra Credit']" \ No newline at end of file diff --git a/gradingscript.dockerfile b/gradingscript.dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..d368cdb2ad3dbb326417651489621c348c07eb53 --- /dev/null +++ b/gradingscript.dockerfile @@ -0,0 +1,17 @@ +# Use the official Python image from the Docker Hub +FROM python:3.9-slim + +# Set the working directory in the container +WORKDIR /app + +# Copy the requirements file into the container +COPY requirements.txt . + +# Install the dependencies +RUN pip3 install --no-cache-dir -r requirements.txt + +# Copy the rest of the application code into the container +COPY . . + +# Specify the command to run the application +CMD ["python3", "main.py"] \ No newline at end of file diff --git a/main.py b/main.py index bc62e72478276cccc18330572026aa75ed56a563..1d2e11795b7f2c7fd285b43c1a6868a6e0db9103 100644 --- a/main.py +++ b/main.py @@ -4,6 +4,7 @@ from colored import Fore, Style #Documentation: https://dslackw.gitlab.io/colore from time import sleep import os +import json """ @@ -28,8 +29,12 @@ Environment Variable Imports title = os.getenv("ASSIGNMENT_TITLE", default="Assignment Title") scoreDefault = os.getenv("SCORE_DEFAULT", default=100) # What the score is out of -latePenalty = scoreDefault * float(os.getenv("LATE_PENALTY", default="0.1")) -defaults = os.getenv("POINTS_FOR_RUNS", default=[10,20,0]) +latePenalty = int(os.getenv("LATE_PENALTY", default="8")) +# defaults = os.getenv("POINTS_FOR_RUNS", default=[10,20,0]) +defaults_env = os.getenv("DEFAULT_POINTS", default="[[10],[15,20],[0]]") +defaults = json.loads(defaults_env) +defaultLabels_env = os.getenv("DEFAULT_LABELS", default='["Name", "Steps", "Extra Credit"]') +defaultLabels = json.loads(defaultLabels_env) """ * CHANGEABLE """ @@ -43,16 +48,16 @@ defaults = os.getenv("POINTS_FOR_RUNS", default=[10,20,0]) # Default points stored for each run. Each list entry is a run. A default run score of 0 allows extra credit. -defaultLabels = ["Name", "Steps", "Extra Credit"] +# defaultLabels = ["Name", "Steps", "Extra Credit"] -defaults = [ - [10], - [15,20], - [0]] +# defaults = [ +# [10], +# [15,20], +# [0]] # Late penalty if submission is late. 0 for no penalty -latePenalty = 8 # 10% of score default +# latePenalty = 8 # 10% of score default """ ! NON CHANGEABLE