Autograding Image
Important
If you want to create a new container for the autograder in your course, you need to write a Dockerfile and send it to the DTU Compute IT department, where it will be installed.
It might be a good idea to install Autolab and Docker on your own computer, which makes it possible to test your Dockerfiles before they are installed on the DTU server. A tutorial for this installation can be found here.
Note
- Ignore the TLS/SSL configuration if you only test on your local machine.
- If running Autolab via
http://localhostdoes not grade your submissions, you can add127.0.0.1 autolabto the system configuration file/etc/hostsin MacOS or\Windows\System32\drivers\etc>type hostson Windows and access autolab viahttp://autolabin your browser. Remember to remove it again when it is not needed anymore.
The default Docker container autograding_image, which is provided by Autolab, does not have any special software installed. It looks like:
# Autolab - autograding docker image
FROM ubuntu:18.04
MAINTAINER Autolab Team <autolab-dev@andrew.cmu.edu>
RUN apt-get update && apt-get install -y \
build-essential \
gcc \
git \
make \
sudo \
&& rm -rf /var/lib/apt/lists/*
# Install autodriver
WORKDIR /home
RUN useradd autolab
RUN useradd autograde
RUN mkdir autolab autograde output
RUN chown autolab:autolab autolab
RUN chown autolab:autolab output
RUN chown autograde:autograde autograde
RUN git clone --depth 1 https://github.com/autolab/Tango.git
WORKDIR Tango/autodriver
RUN make clean && make
RUN cp autodriver /usr/bin/autodriver
RUN chmod +s /usr/bin/autodriver
# Clean up
WORKDIR /home
RUN apt-get remove -y git && apt-get -y autoremove && rm -rf Tango/
# Check installation
RUN ls -l /home
RUN which autodriverThe examples in this tutorial use Python. A possible modification to the Dockerfile above to include installing Python and NumPy could look like:
# Autolab - autograding docker image with Python
FROM ubuntu:22.04
LABEL maintainer="Julien Hirsch <s233493@dtu.dk>" \
original_author="Autolab Team <autolab-dev@andrew.cmu.edu>" \
description="Customized Autolab image with added Python libraries"
RUN apt-get update && apt-get install -y \
build-essential \
gcc \
git \
make \
sudo \
python3 \ # For Python
python3-numpy \ # For Python
&& rm -rf /var/lib/apt/lists/*
# Install autodriver
WORKDIR /home
RUN useradd autolab
RUN useradd autograde
RUN mkdir autolab autograde output
RUN chown autolab:autolab autolab
RUN chown autolab:autolab output
RUN chown autograde:autograde autograde
RUN git clone --depth 1 https://github.com/autolab/Tango.git
WORKDIR Tango/autodriver
RUN make clean && make
RUN cp autodriver /usr/bin/autodriver
RUN chmod +s /usr/bin/autodriver
# Clean up
WORKDIR /home
RUN apt-get remove -y git && apt-get -y autoremove && rm -rf Tango/
# Check installation
RUN ls -l /home
RUN which autodriver
RUN python3 --versionOnce you have installed Autolab Docker Compose and written your Dockerfile, you can build the new autograding image. To do so, you have to move your Dockerfile into the autolab-docker/Tango/vmms/folder, stop all Docker containers, build the autograding image from your Dockerfile and lastly, run the Docker containers again.
The following is a precise collection of commands to do this task:
cd autolab-docker
# Move your Dockerfile and rename it to Dockerfile
cp ~/newDockerfile Tango/vmms/Dockerfile
docker compose stop
# Build autograding image and specify name e.g. autograding_imagename
docker build -t autograding_imagename Tango/vmms/
# Check if your image is there
docker images
docker compose up -d
mv Tango/vmms/Dockerfile Tango/vmms/autograding_imagename