FROM arm64v8/fedora:rawhide

COPY qemu-aarch64-static /usr/bin/qemu-aarch64-static

RUN dnf install -y gcc make bison autoconf ruby
RUN dnf install -y wget tar xz

ARG RUBY_MAJOR=2.5
ARG RUBY_VERSION=2.5.0
ARG use_volume=""
ARG jobs=4

RUN [ -z "${use_volume}" ] \
    && mkdir -p /usr/src/ruby \
    && cd /usr/src/ruby \
    && wget -O ../ruby.tar.xz "https://cache.ruby-lang.org/pub/ruby/${RUBY_MAJOR%-rc}/ruby-$RUBY_VERSION.tar.xz" \
    && tar -xJf ../ruby.tar.xz  --strip-components=1 \
    && ./configure

WORKDIR /usr/src/ruby
RUN make -j${jobs} ruby || :
CMD make
