-
Notifications
You must be signed in to change notification settings - Fork 155
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #64 from gradescope/ibrahim/GSC-2257/dockerfile-ex…
…ample Add example Dockerfile for manual docker config
- Loading branch information
Showing
4 changed files
with
53 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# You can change these variables to use a different base image, but | ||
# you must ensure that your base image inherits from one of ours. | ||
# You can also override these at build time with --build-arg flags | ||
ARG BASE_REPO=gradescope/auto-builds | ||
ARG TAG=latest | ||
|
||
FROM ${BASE_REPO}:${TAG} | ||
|
||
RUN apt-get update && \ | ||
apt-get install -y dos2unix && \ | ||
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* | ||
|
||
ADD source /autograder/source | ||
|
||
RUN cp /autograder/source/run_autograder /autograder/run_autograder | ||
|
||
# Ensure that scripts are Unix-friendly and executable | ||
RUN dos2unix /autograder/run_autograder /autograder/source/setup.sh | ||
RUN chmod +x /autograder/run_autograder | ||
|
||
# Do whatever setup was needed in setup.sh, including installing apt packages | ||
# Cleans up the apt cache afterwards in the same step to keep the image small | ||
RUN apt-get update && \ | ||
bash /autograder/source/setup.sh && \ | ||
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* | ||
|
||
# You can also use RUN commands in the Dockerfile to install things | ||
# instead of using a bash script | ||
|
||
# The base image defines the CMD and ENTRYPOINT, so don't redefine those |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/usr/bin/env bash | ||
|
||
/usr/games/cowsay "Hello, world!" | ||
|
||
files_submitted=$(ls /autograder/submission) | ||
num_files_submitted=$(ls /autograder/submission/ | wc -l) | ||
|
||
cat > /autograder/results/results.json <<EOF | ||
{ | ||
"output": "Good job, you passed! Submitted ${num_files_submitted} files: ${files_submitted}", | ||
"score": 10, | ||
"max_score": 10 | ||
} | ||
EOF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
apt-get install -y cowsay |