Sign inSign up

flowcoreio/adapter-nodejs-transformer-shell

By flowcoreio

Updated over 1 year ago

Nodejs Transformer Shell for the Flowcore Platform

Image
0

10K+

flowcoreio/adapter-nodejs-transformer-shell repository overview

NodeJS Typescript Transformer Example Repository

This repository contains a simple example of a NodeJS Typescript Transformer. This is used for custom transformations in the Flowcore Platform

Environment Variables
Environment VariableDescriptionTypeDefault ValueRequired
PORTThe port the service will listen onnumber3000
TRANSFORMERSThe transformers available when transformingstring[node]
TRANSFORMER_BASE_URLThe base http url the transformer is listening onstringhttp://localhost
START_PORTThe port to start hosting transformers onnumber10000
MAX_IDLE_TIME_IN_SECONDSThe maximum time a transformer can be idle before being unloadednumber500
TRANSFORMER_DEPENDENCY_COMMANDThe command to run to install transformer dependenciesstringnpm install --omit=dev --no-update-notifier --no-warnings --ignore-scripts
TRANSFORMER_DEPENDENCY_FILEThe file to check for to determine if dependencies need to be installedstringpackage.json
TRANSFORMER_RUN_COMMANDThe command that is run when the transformer is startedstring
TRANSFORMER_PORT_ENV_NAMEThe transformer port environment variable namestringPORT
HOOK_PRE_LOADThe command that is run before the transformer is loadedstring
HOOK_POST_LOADThe command that is run after the transformer is loadedstring
HOOK_PRE_INSTALLThe command that is run before the transformer dependencies are installedstring
HOOK_POST_INSTALLThe command that is run after the transformer dependencies are installedstring
HOOK_PRE_STARTThe command that is run before the transformer is startedstring
HOOK_POST_STARTThe command that is run after the transformer is startedstring
HOOK_PRE_UNLOADThe command that is run before the transformer is unloadedstring
HOOK_POST_UNLOADThe command that is run after the transformer is unloadedstring

Customization

To add a custom runtime to the transformer, extend from this container and customize the TRANSFORMERS, TRANSFORMER_DEPENDENCY_COMMAND, TRANSFORMER_RUN_COMMAND AND TRANSFORMER_DEPENDENCY_FILE environment variables.

For Example Python
FROM flowcoreio/adapter-nodejs-transformer-shell:1.9.0

USER root
# install python3
ENV PYTHONUNBUFFERED=1

RUN apk add --update --no-cache python3 && ln -sf python3 /usr/bin/python
RUN python3 -m ensurepip
RUN pip3 install --no-cache --upgrade pip setuptools

ENV HOOK_PRE_LOAD="python -m venv .venv"
ENV TRANSFORMER_DEPENDENCY_COMMAND="source .venv/bin/activate && pip install --isolated -r requirements.txt"
ENV TRANSFORMER_DEPENDENCY_FILE="requirements.txt"
ENV TRANSFORMER_RUN_COMMAND="source .venv/bin/activate && uvicorn {}:app"
ENV TRANSFORMERS="python"
ENV TRANSFORMER_PORT_ENV_NAME="UVICORN_PORT"

USER node

Tag summary

Content type

Image

Digest

sha256:0883a7111

Size

91.7 MB

Last updated

over 1 year ago

docker pull flowcoreio/adapter-nodejs-transformer-shell