I am trying to build a simple HelloWorld docker image using apama-builder. However I am getting the following error:
INFO: copying the project file from /app/HelloWorld to output directory /app/deployed
ERROR: Failed to create correlator initialization list: /app/deployed
The command '/bin/sh -c engine_deploy --outputDeployDir /app/deployed /app/HelloWorld' returned a non-zero code: 100
My Docker File looks like as below:
# Use the build environment
FROM store/softwareag/apama-builder:10.3 as builder
# Copy project assets into build environment
COPY --chown=1724:1724 . /app/HelloWorld
# Deploy the apama project
RUN engine_deploy --outputDeployDir /app/deployed /app/HelloWorld
# Add any additional build steps you may have, such as building plugins, here
# RUN ...
# Final image is based on the runtime base image
FROM store/softwareag/apama-correlator:10.3
# Copy deployed project from the build environment
COPY --chown=1724:1724 --from=builder /app/deployed /app/deployed
# Add copies for any additional build artifacts created in the build environment
# COPY --from=builder ...
WORKDIR /app
# Run the deployed project
CMD ["correlator", "--config", "Project_deployed", "--logfile", "/dev/stdout"]
Note I am using CentOS, and my HelloWorld application is located at /app/HelloWorld and I want the output to be at /app/deployed.
There are a couple of issues, but it stems from the fact that the deploy process doesn't run as root and so can't create the output directory. It fooled me initially as well :)
Firstly the
# Copy project assets into build environment
COPY --chown=1724:1724 . /app/HelloWorld
works but the engine_deploy won't because it can't access /app/deployed
so if you change the engine_deploy line to
RUN engine_deploy --outputDeployDir ${APAMA_WORK}/deployed /app/HelloWorld
It will create the runnable application deployment in the "work" directory usually /apama_work
Now because it isn't where you placed it you'll need to change the copy from the builder
# Copy deployed project from the build environment
COPY --chown=1724:1724 --from=builder ${APAMA_WORK}/deployed ${APAMA_WORK}/deployed
and lastly the CMD line needs to change
# Run the deployed project
CMD ["correlator", "--config", "deployed", "--logfile", "/dev/stdout"]
to match the output directory