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 login
Then log into heroku's docker registry:
$ heroku container:login
Create your own Heroku application:
$ heroku create
Then you can push the docker image to heroku's repository (the docker image will be built locally):
$ heroku container:push --recursive
You can then release the docker image:
$ heroku container:release web
Finally, you call open the application:
$ heroku app:open
That's it!
The docker image is based on ubuntu (latest), it has multiple stages to try to shorten the build time.
- Stage
basepackages
contains the OS and a few packages (like sbcl) needed at build- and run-time. - Stage
quicklisp
install and configure quicklisp. Notably, it also installs ironclad because it's a package that takes a while to compile. - Stage
dependencies
is 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.asd
to know what are the (quicklisp) dependencies of the application. And it usescompile-dependencies.lisp
to build an image (dependencies.core
) that contains all the application's dependencies. - Stage
build
copies all the source files, loaddependencies.core
and load the (common lisp) systemexample
and 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
lispapp
executable in an extra stage at the end.