Browse Source

h2o_mruby: Update the dependencies and clean up the Dockerfile (#7903)

Anton Kirilov 2 years ago
parent
commit
a87925d674
2 changed files with 30 additions and 15 deletions
  1. 6 2
      frameworks/Ruby/h2o_mruby/README.md
  2. 24 13
      frameworks/Ruby/h2o_mruby/h2o_mruby.dockerfile

+ 6 - 2
frameworks/Ruby/h2o_mruby/README.md

@@ -2,8 +2,12 @@
 
 
 This is a framework implementation using the [H2O](https://h2o.examp1e.net/) HTTP server
 This is a framework implementation using the [H2O](https://h2o.examp1e.net/) HTTP server
 and the [mruby](https://mruby.org/) implementation of the [Ruby](https://www.ruby-lang.org/)
 and the [mruby](https://mruby.org/) implementation of the [Ruby](https://www.ruby-lang.org/)
-language.
+programming language.
 
 
 ## Requirements
 ## Requirements
 
 
-H2O
+[H2O](https://h2o.examp1e.net/)
+
+## Test implementations
+
+The test implementations are located inline into the [h2o.conf](h2o.conf) configuration file.

+ 24 - 13
frameworks/Ruby/h2o_mruby/h2o_mruby.dockerfile

@@ -1,20 +1,31 @@
-FROM ruby:2.6
+ARG RUBY_IMAGE_VERSION=3.2
 
 
-ADD ./h2o.conf ./
+ARG H2O_PREFIX=/opt/h2o
 
 
-RUN apt-get update && apt-get install -yqq bison cmake libssl-dev make
+FROM ruby:${RUBY_IMAGE_VERSION} AS compile
 
 
-ENV H2O_VERSION=2.3.0-beta2
-ENV H2O_ARCHIVE="v${H2O_VERSION}.tar.gz"
-ENV H2O_HOME=/h2o
+ARG H2O_VERSION=9ab3feb4d7429ddda52a3cf84bd6da0e890bd52a
 
 
-RUN wget -q "https://github.com/h2o/h2o/archive/$H2O_ARCHIVE" && \
-    tar xf "$H2O_ARCHIVE" && \
-    cd "h2o-$H2O_VERSION" && \
-    cmake -DCMAKE_INSTALL_PREFIX="$H2O_HOME" -DCMAKE_C_FLAGS="-flto -march=native" \
-          -DCMAKE_AR=/usr/bin/gcc-ar -DCMAKE_RANLIB=/usr/bin/gcc-ranlib -DWITH_MRUBY=on . && \
-    make -j "$(nproc)" install
+ARG DEBIAN_FRONTEND=noninteractive
+RUN apt-get -yqq update && apt-get -yqq install cmake ninja-build
+WORKDIR h2o-build
+ARG H2O_ARCHIVE="${H2O_VERSION}.tar.gz"
+ADD "https://github.com/h2o/h2o/archive/${H2O_ARCHIVE}" ./
+RUN tar --strip-components=1 -xf "${H2O_ARCHIVE}"
+ARG H2O_PREFIX
+WORKDIR build
+RUN cmake -G Ninja -DCMAKE_C_FLAGS="-flto -march=native -mtune=native" -DWITH_MRUBY=on \
+          -DCMAKE_AR=/usr/bin/gcc-ar -DCMAKE_RANLIB=/usr/bin/gcc-ranlib \
+          -DCMAKE_INSTALL_PREFIX="${H2O_PREFIX}" .. && \
+    cmake --build . -j && \
+    cmake --install .
+WORKDIR /
 
 
+FROM ruby:${RUBY_IMAGE_VERSION}-slim
+
+ARG H2O_PREFIX
+ADD ./h2o.conf "${H2O_PREFIX}/"
+COPY --from=compile "${H2O_PREFIX}" "${H2O_PREFIX}/"
 EXPOSE 8080
 EXPOSE 8080
 
 
-CMD "${H2O_HOME}/bin/h2o" -c h2o.conf
+CMD ["/opt/h2o/bin/h2o", "-c", "/opt/h2o/h2o.conf"]