adding a new language and unit-test-framework to cyber-dojo

0. make sure docker is installed.

  • For Linux see the first step here.
  • For Mac see the first step here.
  • For Windows see the first step here.

1. create a docker-image for just the language

Make this docker-image unit-test-framework agnostic.
If you are adding a new unit-test-framework to an existing language skip this step.
For example, suppose you were building Lisp
  • create a new folder for your language
    $ md lisp
  • in your language's folder, create a file called Dockerfile
    $ cd Lisp $ touch Dockerfile
    If you can, base your new image on Alpine-linux as this will help keep images small. To do this make the first line of Dockerfile as follows
    FROM cyberdojofoundation/language-base
    Here's one based on Alpine-linux (95 MB: C, assert) C (gcc)/assert/Dockerfile
    Here's one not based on Alpine (Ubuntu 845 MB: C#, NUnit) C#/NUnit/Dockerfile
  • use the Dockerfile to try and build your docker-image.
    For example
    $ docker build -t cyberdojo/lisp .
    which, if it completes, creates a new docker-image called cyberdojo/lisp using the Dockerfile (and build context) in . (the current folder).

2. create a docker-image for the language and unit-test-framework

Repeat the same process, building FROM the docker-image you created in the previous step.
For example, suppose your Lisp unit-test framework is called lunit
  • create a new folder underneath your language folder
    $ cd lisp $ md lunit
  • in your new test folder, create a file called Dockerfile
    $ cd lisp/lunit $ touch Dockerfile
    The first line of this file must name the docker image you built for your language in the previous step.
    Add lines for all the commands needed to install your unit-test framework prefixed with RUN.
    FROM cyberdojo/lisp RUN apt-get install -y lispy-lunit RUN apt-get install -y ...
    If you do not need any commands you should still create a Dockerfile with the single FROM line.
  • use the Dockerfile to try and build your image.
    The name of an image takes the form hub-name/image-name. Do not include a version number in the image-name. For example
    $ docker build -t cyberdojo/lisp_lunit .
    which, if it completes, creates a new docker image called cyberdojo/lisp_lunit using the Dockerfile in . (the current folder).

3. use the image in a new start-point

Use the new image name (eg cyberdojo/lisp_lunit) in a new manifest.json file in a new start-point.

No comments:

Post a Comment