- clack
- myway
- quicklisp
(defpackage :server
(:use :cl :clack :myway)
(:export :server :*mapper*))
(in-package :server)
(defvar *mapper* (make-mapper))
(connect *mapper* "/"
(lambda (params)
'(200
(:content-type "text/plain")
("Hello, world"))))
(connect *mapper* "/greet/?:name?"
(lambda (params)
(list 200
'(:content-type "text/plain")
(list
(format nil "Hello ~A"
(getf params :name))))))
(connect *mapper* "/favicon.ico"
(lambda (params)
'(200
(:content-type "text/plain")
("hello"))))
(defun server (port)
(clackup (to-app *mapper*)
:address "0.0.0.0"
:port port))
sbcl --eval "(ql:quickload '(clack myway))" --load server.lisp --eval "(server:server 4000)"
(ql:quickload '(clack myway))
(load "/src/server.lisp")
(server:server 4000)
FROM ubuntu
RUN apt-get update && \
apt-get install -y build-essential && \
apt-get install -y curl \
libblas-dev \
libffi-dev \
liblapack-dev \
libz-dev \
libzmq3-dev \
rlwrap \
sbcl && \
apt-get clean
WORKDIR /src
RUN curl -o /tmp/quicklisp.lisp 'https://beta.quicklisp.org/quicklisp.lisp' && \
sbcl --noinform --non-interactive --load /tmp/quicklisp.lisp --eval \
"(quicklisp-quickstart:install)" && \
sbcl --noinform --non-interactive --load ~/quicklisp/setup.lisp --eval \
'(ql-util:without-prompting (ql:add-to-init-file))' && \
echo '#+quicklisp(push "/src" ql:*local-project-directories*)' >> ~/.sbclrc && \
rm -f /tmp/quicklisp.lisp
COPY ./server.lisp /src/server.lisp
COPY ./start.lisp /src/start.lisp
RUN sbcl --noinform \
--disable-ldb \
--lose-on-corruption \
--eval "(ql:quickload '(clack myway))"
CMD ["sbcl", "--load", "start.lisp"]