python_server image

The python_server image builder packages your python code as a docker image which starts a web server to serve your code via HTTP calls.

  - image: myorg/myrepo:mypythonserver
    type: python_server
    source: relative/path/to/source
    endpoints:
      - endpoint: /myendpoint
        module: my_module
        function: my_function
      - endpoint: /myotherendpoint
        module: my_module2
        function: my_function2

attributes

image: name of your image.

source: location of source files to include in the image, this can be a relative path within your project, or even . which means the entire project should be packaged in the image.

endpoint: list of endpoints to expose in the server.

endpoint attributes

endpoint: path to your endpoint in the server.

module: module containing your user code.

function: name of the function within the module that should be called when handling this endpoint. the function should expect a dictionary as an input (or None if no input) and should return a string to return in the response to the HTTP call.