Building a Custom Development Image
This document describes how to build a custom development image to use in SonataFlow.
The development mode image structure
The development image is based on the Red Hat UBI 8 minimal container image. You can read its documentation for more detailed information about that image’s architecture.
The table below lists the additional packages installed in the development mode container image.
Package | Description |
---|---|
shadow-utils |
The shadow-utils package includes the necessary programs for converting UNIX password files to the shadow password format. |
tar |
|
gzip |
|
unzip |
|
zip |
|
tzdata-java |
|
java-11-openjdk-devel |
OpenJDK 11 |
apache-maven-3.8.6-bin.tar.gz |
Apache Maven |
The next table lists the important paths in the container image’s file system.
Path | Description |
---|---|
|
Default user home directory |
|
Useful scripts to run the application |
|
Workflow application directory in Maven format |
|
Default Maven cache repository |
Using the development mode as base image
Below you can find an example of a Dockerfile using the dev mode image as a base image to run a workflow capable of executing Python scripts.
FROM quay.io/kiegroup/kogito-swf-devmode:main (1)
USER root (2)
RUN microdnf install -y --nodocs python311 gcc python3.11-devel mesa-libGLU && \ (3)
microdnf clean all && \
ln -s /usr/bin/python3 /usr/bin/python && \
curl -sSL https://bootstrap.pypa.io/get-pip.py | python
USER 1001 (4)
ENV PATH="${PATH}:/home/kogito/.local/bin" (5)
COPY requirements.txt /home/kogito/serverless-workflow-project/ (6)
RUN pip install numpy
RUN pip install -r requirements.txt
ENV QUARKUS_EXTENSIONS="org.kie.kogito:kogito-addons-quarkus-serverless-workflow-python:snapshot" (7)
CMD ["/home/kogito/launch/run-app-devmode.sh"] (8)
1 | The dev mode image as the base image |
2 | Change to super user to run privileged actions |
3 | Install additional packages |
4 | Change back to the default user without admin privileges |
5 | Add a new binary path to the PATH |
6 | Copying a file to the project’s root path |
7 | Optionally adding a new Quarkus addon to the project |
8 | Defining the default entrypoint for the image |
You can then build this image using the following command:
docker build -t quay.io/acme/sonataflow-python-devmode:latest .
You can experiment with your new image running the container locally, for example:
docker run -it --rm -p 8080:8080 -v /path/to/my/local/project/resources:/home/kogito/serverless-workflow-project/src/main/resources quay.io/acme/sonataflow-python-devmode:latest
The container exposes port 8080 by default. When running the container locally, you must forward any free local port to 8080. In this example, we use the same 8080 port.
Next, we mount a local volume to the container’s application path. Any local workflow definitions, specification files, or properties should be mounted to src/main/resources
. Alternatively, you can also mount custom Java files to src/main/java
.
Finally, to use the new generated image with the dev profile you can see: Using another Workflow base image.
Found an issue?
If you find an issue or any misleading information, please feel free to report it here. We really appreciate it!