Skip to content

How to create a new container

Cristian Gonzalez edited this page Jul 8, 2021 · 9 revisions

How to create a new grading container

In this page you will see how to create a new container to assess a submission with another language or dependencies using Docker. Here you will find help about how to create containers with new languages, programs, and dependencies for UNCode. In order to make possible to extend available tools to assess the student's work. See the grading containers documentation to understand more about them. As here we will focus on how to a new grading container.

Step by step guide

  1. You must have already cloned or forked the repository to start adding this new container.

  2. Create folder related to the container to create:

    Once you are located into the INGInious-containers repository, go into the grading folder (where are located all the containers):

cd grading/

​ Create your new container folder (replace my-new-container with the desired name for the container) :

mkdir my-new-container
  1. Copy files and/or necessary dependencies not installable by yum

    In the case that are needed software or files that are not available by package manager 'yum' as in the case of verilog container. In order to add dependencies, just copy that what is needed into the already created folder.

  2. Create a Dockerfile

    Create a file called Dockerfile and write the next code into it:

    FROM 	unjudge/uncode-c-base
    LABEL 	org.inginious.grading.name = "my-new-container"
    # Add other additional CentOS commands to install dependencies
    
    ADD     . /UNCode
    RUN     cp -R /UNCode/grading/.  /usr/lib/python3.6/site-packages/grading/
    RUN     rm -R /UNCode

    FROM clause specifies the immediate ancestor from the new container will inherit, for this case, this will be unjudge/uncode-c-base, which already contains a lot of utilities that you will probably use. You can choose which container you inherit from, as each container also implements different functionalities.

    LABEL clause specifies the new container's name. This name will be the same that is shown in the platform in the task settings, in environment tab.

    RUN clause specifies a CentOS command, in this case, CentOS package manager is a program called yum. For instance you may add compilers or other tools, for instance, nodejs.

    Replace my-new-container with your container's name. Then, write the commands that have to be executed either to copy the files or to install dependencies.

    This Dockerfile copies the files inside this folder through the ADD clause and installs it through the command in the RUN clause. For more information about supported clauses, please consult the official documentation.

  3. Add your grading files

    In case you want that tasks are automatically configured and this container is in charge of parsing the files and the submission, you have to add the corresponding code. For that you have to add a new language factory to execute the submission, as well as using other utilities available in the uncode/ folder. Check the notebook/, multilang/, hdl/ folders to see how the grading functionality is extended to accept different language for each environment.

  4. Test the Dockerfile:

    For testing the right work of Dockerfile, it is necessary to have installed Docker, build the container with next command and set a correct tag to the generated image.

docker build -t unjudge/inginious-c-<my-new-container> .
  1. Restart tthe UNCode process to register the new container within the other grading environments and try submitting code.
  2. In some cases it is necessary to do some changes in the frontend to start using the container and new submissions, for instance, it might be necessary to add a new subproblem or to modify the available languages, for that check the multilang plugin to determine which changes are required.
Clone this wiki locally