Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions frameworks/Ruby/h2o_mruby/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@

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/)
language.
programming language.

## Requirements

H2O
[H2O](https://h2o.examp1e.net/)

## Test implementations

The test implementations are located inline into the [h2o.conf](h2o.conf) configuration file.
37 changes: 24 additions & 13 deletions frameworks/Ruby/h2o_mruby/h2o_mruby.dockerfile
Original file line number Diff line number Diff line change
@@ -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

CMD "${H2O_HOME}/bin/h2o" -c h2o.conf
CMD ["/opt/h2o/bin/h2o", "-c", "/opt/h2o/h2o.conf"]