This project is an example of how to deploy a common lisp server to heroku using docker.
Fork or clone this project (and optionally modify it with your own content).
Get yourself set up with a Heroku account and tools.
Install heroku's command line interface.
Make sure you're logged in with heroku:
$ heroku loginThen log into heroku's docker registry:
$ heroku container:loginCreate your own Heroku application:
$ heroku createThen you can push the docker image to heroku's repository (the docker image will be built locally):
$ heroku container:push --recursiveYou can then release the docker image:
$ heroku container:release webFinally, you call open the application:
$ heroku app:openThat's it!
The docker image is based on ubuntu (latest), it has multiple stages to try to shorten the build time.
- Stage
basepackagescontains the OS and a few packages (like sbcl) needed at build- and run-time. - Stage
quicklispinstall and configure quicklisp. Notably, it also installs ironclad because it's a package that takes a while to compile. - Stage
dependenciesis the first stage that depends on the application's code. It uses only 2 files from the context (the directory from which docker copies the files). It uses the fileexample.asdto know what are the (quicklisp) dependencies of the application. And it usescompile-dependencies.lispto build an image (dependencies.core) that contains all the application's dependencies. - Stage
buildcopies all the source files, loaddependencies.coreand load the (common lisp) systemexampleand create an executable calledlispapp. The entry-point of the executable is the functionexample:start.
It would be possible to improve the size of the docker image by including only the
lispappexecutable in an extra stage at the end.