If you're planning to make a backend application using Pharo worker images, you'll probably setup a Jenkins or some kind of CI server.
Two minutes after that the CI server will need to have a terminal command to :
- Start the image build.
- Load all the requisites and app packages.
- Save image and quit.
So the first thing you might want to make is to create some code to fileIn. After all the package loading, you might put some method there to save image and quit.
That will start the build and load all but you'll not be able to open the image again. When you try to open that fresh built image it will close itself in a split second. You'll not see any crash dumps or error logs nothing anomalous. That's because is not a crash or an error. Is simply a normal image quit.
After digging into the issue for a while and testing different combinations, I've figured out the command that allows to do the three things: build, load and save properly.
/pharo -vm-display-null airflowing.image AirflowingWorkerBuilder.st --quit
How does it work?
The way it works is this: it loads requisites and packages from the filedIn
AirflowingWorkerBuilder.st code, after all packages are loaded the image saves with a
Smalltalk imageSave, and finally exits.
Have in mind the image quit should not be done by the filedIn script. Another thing you should not do is to try a
Smalltalk saveImage: anImageName andQuit: true from your filedIn script, otherwise it will create an image that you cannot open anymore.
Use the command line
--quit to automate image quits instead of coding it. If you use
--quit from the command line the image state when saving will remain as expected when the image closes.