Pier on Docker

This uses the Buenos Aires Smalltalk group's docker work and here-docs (just create the files with the text between the greater-thans and the closing bang if your shell does not support it):

0 Johns-MacBook-Pro$ mkdir pharo-pier; cd pharo-pier
0 Johns-MacBook-Pro$ cat > start.st <<-!
Transcript show: 'Pier should be running in the background'.

"Suspend UI process, not needed on headless"
(Process allSubInstances reject: #isTerminated)
	detect: [ :process | process name includesSubstring: 'UI Process' ]
	ifFound: [ :process | process suspend ].
Processor activeProcess suspend.
!
0 Johns-MacBook-Pro$ cat > load-project.st <<-!

Metacello new
 baseline:'Pier';
 repository: 'github://Pier-CMS/Pier3:main/repository';
 onConflictUseLoaded;
 load: 'todo'.

!
0 Johns-MacBook-Pro$ cat > Dockerfile <<-!
# Use the images generated from this repository as base
FROM basmalltalk/pharo:9.0-image

# Put the load-project.st script in the docker image and then load the project
COPY load-project.st ./
RUN pharo Pharo.image load-project.st --save --quit

# Put start.st in the docker image and configure the docker image to start it
COPY start.st ./
CMD [ "pharo", "Pharo.image", "start.st" ]
!
0 Johns-MacBook-Pro$ docker build . -t pharo-pier                                       
0 Johns-MacBook-Pro$ docker run --interactive --tty --rm --publish 8080:8080 pharo-pier

The last command should display the transcript message of pier running. If one connects to http://localhost:8080/pier the basic pier in a web browser. By changing load-project.st with another pier project or branch then a larger project can be tested.

Posted by John Borden at 14 July 2021, 3:06 pm link