dockercommon-lispgnu-common-lispansi-common-lisp

Installing Quicklisp libraries in a Docker image


Is there a Dockerfile for installing cl-json (or other Quicklisp library) on Docker? Most installation instructions I've seen require user input on commands with no --noinput flag, making it difficult to install through a Dockerfile.

In addition, many of the instructions appear out of date or reference broken links and non-existent resources. It would be convenient to use a Dockerfile to install it in a consistent way with e.g. Quicklisp.


Solution

  • Here is a possible Dockerfile for an application based on SBCL.

    FROM dparnell/minimal-sbcl
    RUN sbcl --noinform \
             --disable-ldb \
             --lose-on-corruption \
             --eval "(ql:quickload '(buildapp))" \
             --eval '(buildapp:build-buildapp "/bin/buildapp")'
    
    RUN buildapp --load /opt/quicklisp/setup.lisp \
                 --eval "(ql:quickload '(cl-json))" \
                 --output bin/executable
    
    CMD executable
    

    I am basing the image on dparnell/minimal-sbcl, which comes with Quicklisp pre-installed.

    I then run SBCL once to build buildapp (that could be a separate docker image).

    Then, I run buildapp, load quicklisp/setup.lisp and install cl-json. You can load as many dependencies you want with quickload, but I'd recommand defining your own system.asd file and list dependencies there.