Преглед изворни кода

Updated the Dockerfile (#4690)

* Refactored the entire code to add add database bound handlers

* Updated `.travis.yml`

* Replaced the Dockerfile to update the dependencies (Linux, Roswell, Quicklibs, SBCL, …) to the (al)most recent versions

* Updated the Dockerfile. Reduced the image size from 491MB to 255MB
Gert Thiel пре 6 година
родитељ
комит
a7622436f2

+ 3 - 3
frameworks/Lisp/woo/benchmark_config.json

@@ -13,15 +13,15 @@
                 "approach": "Realistic",
                 "approach": "Realistic",
                 "classification": "Micro",
                 "classification": "Micro",
                 "database": "Postgres",
                 "database": "Postgres",
-                "framework": "woo",
+                "framework": "Woo",
                 "language": "Lisp",
                 "language": "Lisp",
                 "flavor": "None",
                 "flavor": "None",
                 "orm": "Raw",
                 "orm": "Raw",
                 "platform": "Lisp",
                 "platform": "Lisp",
-                "webserver": "None",
+                "webserver": "Woo",
                 "os": "Linux",
                 "os": "Linux",
                 "database_os": "Linux",
                 "database_os": "Linux",
-                "display_name": "woo",
+                "display_name": "Woo",
                 "notes": "",
                 "notes": "",
                 "versus": ""
                 "versus": ""
             }
             }

+ 5 - 2
frameworks/Lisp/woo/helpers/parse-argv.lisp

@@ -9,10 +9,13 @@
           if (not (starts-with option "--"))
           if (not (starts-with option "--"))
             do (error "Invalid option: ~S" option)
             do (error "Invalid option: ~S" option)
           else
           else
-            if (equal option "--worker")
-              append (list :worker-num (parse-int-value option value))
+            if (equal option "--address")
+              append (list :address value)
           else
           else
             if (equal option "--port")
             if (equal option "--port")
               append (list :port (parse-int-value option value))
               append (list :port (parse-int-value option value))
+          else
+            if (equal option "--worker")
+              append (list :worker-num (parse-int-value option value))
           else
           else
             do (error "Unknown option: ~S" option))))
             do (error "Unknown option: ~S" option))))

+ 61 - 5
frameworks/Lisp/woo/woo.dockerfile

@@ -1,11 +1,67 @@
-FROM fukamachi/roswell
+FROM debian:stretch AS debian
 
 
-RUN apt update -y
-RUN apt install -y libev-dev
+ARG DEBIAN_FRONTEND=noninteractive
+ARG TERM=linux
+
+RUN echo 'APT::Get::Install-Recommends "false";' > /etc/apt/apt.conf.d/00-general \
+    && echo 'APT::Get::Install-Suggests "false";' >> /etc/apt/apt.conf.d/00-general \
+    && echo 'APT::Get::Assume-Yes "true";' >> /etc/apt/apt.conf.d/00-general \
+    && echo 'APT::Get::force-yes "true";' >> /etc/apt/apt.conf.d/00-general
+
+RUN echo "Europe/Berlin" > /etc/timezone \
+    && dpkg-reconfigure -f noninteractive tzdata
+
+RUN apt-get update -q \
+    && apt-get install --no-install-recommends -q -y \
+         locales \
+    && rm -rf /var/lib/apt/lists/* \
+	  && localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8
+
+ENV LANG en_US.utf8
+
+
+FROM debian AS roswell
+
+RUN apt-get update -q \
+    && apt-get install --no-install-recommends -q -y \
+         bzip2 \
+         ca-certificates curl libcurl3-gnutls \
+         make \
+    && rm -rf /var/lib/apt/lists/* \
+    && curl -L -O https://github.com/roswell/roswell/releases/download/v19.4.10.98/roswell_19.4.10.98-1_amd64.deb \
+    && dpkg -i roswell_19.4.10.98-1_amd64.deb \
+    && ros setup \
+    && rm roswell_19.4.10.98-1_amd64.deb
+
+RUN echo 'export PATH=$HOME/.roswell/bin:$PATH' >> ~/.bashrc
+
+
+FROM roswell AS builder
+
+RUN apt-get update -q \
+    && apt-get install --no-install-recommends -q -y \
+         build-essential \
+         libev-dev \
+    && rm -rf /var/lib/apt/lists/*
 
 
 WORKDIR /woo
 WORKDIR /woo
 ADD  . .
 ADD  . .
 
 
-RUN ["chmod", "+x", "./woo.ros"]
+RUN ros build woo.ros
+
+
+FROM debian
+
+RUN apt-get update -q \
+    && apt-get install --no-install-recommends -q -y \
+         libev4 \
+    && rm -rf /var/lib/apt/lists/*
+
+WORKDIR /woo
+COPY --from=builder /woo/woo .
+
+RUN ["chmod", "+x", "./woo"]
+
+EXPOSE 8080
 
 
-CMD ./woo.ros --worker $(nproc) --port 8080
+CMD ./woo --worker $(nproc) --address 0.0.0.0 --port 8080

+ 1 - 1
frameworks/Lisp/woo/woo.ros

@@ -98,7 +98,7 @@ exec ros -Q -- $0 "$@"
     (sort (copy-list records-p-one) #'string-lessp :key #'second)))
     (sort (copy-list records-p-one) #'string-lessp :key #'second)))
 
 
 (defun fortunes ()
 (defun fortunes ()
-  "FORTUNES handler using Jonathan to encode JSON, Postmodern to access PostgreSQL and Spinneret to build the HTML"
+  "FORTUNES handler using Jonathan to encode JSON, Postmodern to access PostgreSQL and CL-Markup to build the HTML"
   `(
   `(
      200
      200
      (:content-type "text/html; charset=UTF-8" :server "Woo")
      (:content-type "text/html; charset=UTF-8" :server "Woo")