Ver Fonte

minor docker refactor, more command line options with passing

Innocenty Enikeew há 8 anos atrás
pai
commit
d790e8c104
3 ficheiros alterados com 23 adições e 14 exclusões
  1. 4 4
      Dockerfile
  2. 2 1
      travels.asd
  3. 17 9
      travels.lisp

+ 4 - 4
Dockerfile

@@ -26,17 +26,17 @@ RUN apt-get update &&\
     cd ~ &&\
     cd ~ &&\
     echo "Finished installing SBCL. Now it's time for Quicklisp." &&\
     echo "Finished installing SBCL. Now it's time for Quicklisp." &&\
     curl -o /tmp/quicklisp.lisp https://beta.quicklisp.org/quicklisp.lisp &&\
     curl -o /tmp/quicklisp.lisp https://beta.quicklisp.org/quicklisp.lisp &&\
-    echo | sbcl --load /tmp/quicklisp.lisp --eval '(quicklisp-quickstart:install :path "/opt/quicklisp")' --eval '(quicklisp:add-to-init-file)' --eval '(sb-ext:quit)' &&\
-    mkdir -p /opt/quicklisp/local-projects/travels
+    echo | sbcl --load /tmp/quicklisp.lisp --eval '(quicklisp-quickstart:install :path "/opt/quicklisp")' --eval '(quicklisp:add-to-init-file)' --eval '(sb-ext:quit)'
 
 
 WORKDIR /opt/quicklisp/local-projects/
 WORKDIR /opt/quicklisp/local-projects/
 RUN git clone https://github.com/fukamachi/woo.git &&\
 RUN git clone https://github.com/fukamachi/woo.git &&\
     git clone https://github.com/fukamachi/lack.git &&\
     git clone https://github.com/fukamachi/lack.git &&\
     git clone https://github.com/fukamachi/clack.git &&\
     git clone https://github.com/fukamachi/clack.git &&\
     git clone https://github.com/fukamachi/myway.git &&\
     git clone https://github.com/fukamachi/myway.git &&\
-    git clone https://github.com/fukamachi/quri.git
-
+    git clone https://github.com/fukamachi/quri.git &&\
+    mkdir -p /opt/quicklisp/local-projects/travels
 COPY travels.asd *.lisp travels/
 COPY travels.asd *.lisp travels/
+
 RUN sbcl --eval '(ql:quickload :travels)' --eval '(sb-ext:quit)'
 RUN sbcl --eval '(ql:quickload :travels)' --eval '(sb-ext:quit)'
 
 
 EXPOSE 80
 EXPOSE 80

+ 2 - 1
travels.asd

@@ -7,7 +7,8 @@
   :version "0.1"
   :version "0.1"
   :author "Innokenty Enikeev"
   :author "Innokenty Enikeev"
   :license "BSD 3-Clause"
   :license "BSD 3-Clause"
-  :depends-on (:woo
+  :depends-on (:alexandria
+               :woo
                :clack
                :clack
                :lack
                :lack
                :quri
                :quri

+ 17 - 9
travels.lisp

@@ -236,15 +236,23 @@
 (myway:connect *mapper* "/:entity/:id" 'get-entity)
 (myway:connect *mapper* "/:entity/:id" 'get-entity)
 (myway:connect *mapper* "/users/:id/visits" 'user-visits)
 (myway:connect *mapper* "/users/:id/visits" 'user-visits)
 (myway:connect *mapper* "/locations/:id/avg" 'location-avg-mark)
 (myway:connect *mapper* "/locations/:id/avg" 'location-avg-mark)
-(myway:connect *mapper* "*" (lambda (p) (declare (ignore p)) '(404 nil nil)))
+(myway:connect *mapper* "*" (lambda (p) (declare (ignore p)) +404+))
 
 
-(defun main (&key (port 5000) (data "data.zip") (address "0.0.0.0"))
+(defun main (&rest args
+             &key
+               (data "data.zip")
+               (address "0.0.0.0")
+               (port 5000)
+               (debug nil)
+               (use-thread nil) &allow-other-keys)
   (setf *storage* (load-data data))
   (setf *storage* (load-data data))
   (format t "Loaded ~A~%" data)
   (format t "Loaded ~A~%" data)
-  (clack:clackup (myway:to-app *mapper*)
-                 :server :woo
-                 :address address
-                 :port port
-                 :debug nil
-                 :use-default-middlewares nil
-                 :use-thread nil))
+  (apply #'clack:clackup
+         (myway:to-app *mapper*)
+         :server :woo
+         :address address
+         :port port
+         :debug debug
+         :use-default-middlewares nil
+         :use-thread use-thread
+         (alexandria:remove-from-plist args :data :address :port :debug :use-thread)))