/starter-base

repo for the cyberdojo/starter-base Docker image

Primary LanguageRubyBSD 2-Clause "Simplified" LicenseBSD-2-Clause

CircleCI

The source for the cyberdojo/starter-base docker image.

  • You use the $cyber-dojo start-point create ... command to create your own start-point images.

    $ ./cyber-dojo start-point create --help
      Use:
      cyber-dojo start-point create <name> --custom    <url> ...
      cyber-dojo start-point create <name> --exercises <url> ...
      cyber-dojo start-point create <name> --languages <url> ...
      ...
  • If successful, the created image will use cyberdojo/starter-base as its base (FROM) image and will http-serve copies of the start-points in the urls when named in a [cyber-dojo up] command. For example:

    $ ./cyber-dojo start-point create \
          acme/my-languages-start-points \
            --languages \
              https://github.com/cyber-dojo-languages/csharp-nunit             \
              https://github.com/cyber-dojo-languages/gplusplus-googlemock.git \
              https://github.com/cyber-dojo-languages/java-junit.git
    ...
    Successfully built acme/my-languages-start-points
    
    $ ./cyber-dojo up --languages=acme/my-languages-start-points
    ...
  • If unsuccessful, the command will print an error message. For example:

    $ ./cyber-dojo start-point create \
          acme/my-custom-start-points \
            --custom \
              /users/fred/custom
    ERROR: no manifest.json files in
    --custom /users/fred/custom

git-repo-url format

There are 2 kinds of start-points

  • languages/custom. These are specified with full manifest.json files.
  • exercises. These are specified with a subset of the languages/custom manifest.json files and have only two entries:
    • You must specify a display_name
    • You must specify the visible_filenames
      • visible_filenames cannot contain a file called cyber-dojo.sh

API


JSON in, JSON out

  • All methods receive a JSON hash.
    • The hash contains any method arguments as key-value pairs.
  • All methods return a JSON hash.
    • If the method completes, a key equals the method's name.
    • If the method raises an exception, a key equals "exception".

GET alive?()

Useful as a liveness probe.

  • returns
    • true
      { "ready?": true }
  • parameters
    • none
      {}

GET ready?()

Useful as a readiness probe.

  • returns
    • true if the service is ready
      { "ready?": true }
    • false if the service is not ready
      { "ready?": false }
  • parameters
    • none
      {}

GET sha()

The git commit sha used to create the docker image.

  • returns
    • The 40 character sha string
    • eg
      { "sha": "b28b3e13c0778fe409a50d23628f631f87920ce5" }
  • parameters
    • none
      {}

GET names()

The display_names from all manifests.

  • returns
    • A sorted array of strings.
    • eg
      { "names": [
          "C (gcc), assert",
          "C#, NUnit",
          "C++ (g++), assert",
          "Python, py.test",
          "Python, unittest"
        ]
      }
  • parameters
    • none
      {}

GET manifests()

...


GET manifest(name)

The manifest for the given name.

  • returns
    • eg
      { "manifest": {
          "display_name": "C#, NUNit",
          "image_name": "cyberdojofoundation/csharp_nunit",
          "filename_extension": [ ".cs" ],
          "visible_files": {
            "Hiker.cs": {               
              "content": "public class Hiker..."
            },
            "HikerTest.cs": {
              "content": "using NUnit.Framework;..."
            },
            "cyber-dojo.sh": {
              "content": "NUNIT_PATH=/nunit/lib/net45..."
            }
          }
        }
      }
  • parameters
    • name:String from a previous call to the names method above
    • eg
      {  "name": "C#, NUnit" }

GET image_names()

The image_names from all manifests.

  • returns
    • A sorted array of strings.
    • eg
      { "image_names": [
          "cyberdojofoundation/csharp_nunit",
          "cyberdojofoundation/python_unittest",
          "cyberdojofoundation/ruby_mini_test"
        ]
      }
  • parameters
    • none
      {}

cyber-dojo.org home page