Closed cjbottaro closed 7 years ago
I get this error when I try to reproduce:
Step 10/14 : ADD ruby-install-0.6.1.tar.gz /
lstat ruby-install-0.6.1.tar.gz: no such file or directory
However, when I use the ruby package from alpine it works:
FROM alpine:3.5
RUN apk add --no-cache build-base ruby ruby-dev
RUN gem install unf_ext --no-ri --no-rdoc
The ruby version is ruby 2.3.3p222 (2016-11-21 revision 56859) [x86_64-linux-musl]
So my guess is that there are some bug in ruby-install-0.6.1.tar.gz
. You should report it to who ever made that tarball.
You could also try install those dependencies before building ruby:
gmp-dev zlib-dev libressl-dev gdbm-dev db-dev readline-dev
libffi-dev coreutils yaml-dev linux-headers autoconf
Those are the ones we use for the ruby package on alpine.
Hello. Here is my revised Dockerfile. It should run from your computer now (it downloads ruby source from ruby-lang.org). Still fails, even after adding those packages.
FROM alpine:3.5
RUN apk --no-cache add build-base
RUN apk --no-cache add git
RUN apk --no-cache add openssh-client
RUN apk --no-cache add libressl libressl-dev
RUN apk --no-cache add bash
RUN apk --no-cache add readline-dev
RUN apk --no-cache add zlib-dev
RUN apk --no-cache add linux-headers
RUN apk --no-cache add libffi-dev
RUN apk --no-cache add gmp-dev
RUN apk --no-cache add gmp-dev zlib-dev libressl-dev gdbm-dev db-dev readline-dev libffi-dev coreutils yaml-dev linux-headers autoconf
ADD https://cache.ruby-lang.org/pub/ruby/2.3/ruby-2.3.3.tar.gz /
RUN tar xzf ruby-2.3.3.tar.gz
WORKDIR /ruby-2.3.3
RUN ./configure --disable-install-doc
RUN make
RUN make install
RUN gem install unf_ext --no-ri --no-rdoc
ENTRYPOINT /bin/bash
Thank you for the help.
This is an upstream bug. The configure script does not detect isnan/isinf as macros.
You should report this upstream to ruby.
The workaround is to set ac_cv_func_isnan=yes
and ac_cv_func_isinf=yes
when running configure
.
FROM alpine:3.5
RUN apk --no-cache add build-base
RUN apk --no-cache add git
RUN apk --no-cache add openssh-client
RUN apk --no-cache add libressl libressl-dev
RUN apk --no-cache add bash
RUN apk --no-cache add readline-dev
RUN apk --no-cache add zlib-dev
RUN apk --no-cache add linux-headers
RUN apk --no-cache add libffi-dev
RUN apk --no-cache add gmp-dev
RUN apk --no-cache add gmp-dev zlib-dev libressl-dev gdbm-dev db-dev readline-dev libffi-dev coreutils yaml-dev linux-headers autoconf
ADD https://cache.ruby-lang.org/pub/ruby/2.3/ruby-2.3.3.tar.gz /
RUN tar xzf ruby-2.3.3.tar.gz
WORKDIR /ruby-2.3.3
# the configure script does not detect isnan/isinf as macros
RUN ac_cv_func_isnan=yes ac_cv_func_isinf=yes \
./configure --disable-install-doc
RUN make
RUN make install
RUN gem install unf_ext --no-ri --no-rdoc
ENTRYPOINT /bin/bash
Thank you very much for your time helping me with this.
Based on @ncopa's response and on docker-alpine-rbenv.
This solved on Alpine 3.8
:
FROM alpine:3.8
RUN apk add --update bash \
git \
build-base \
linux-headers \
readline-dev \
openssl-dev \
zlib-dev \
gmp-dev \
imagemagick-dev \
libffi-dev \
libffi-dev \
yaml-dev \
&& rm -rf /var/cache/apk/*
ENV RBENV_ROOT '/usr/local/rbenv'
ENV PATH ${RBENV_ROOT}/shims:${RBENV_ROOT}/bin:${PATH}
ENV RUBY_VERSION '2.3.3'
ENV CONFIGURE_OPTS '--disable-install-doc'
RUN git clone --depth 1 git://github.com/sstephenson/rbenv.git ${RBENV_ROOT} \
&& git clone --depth 1 https://github.com/sstephenson/ruby-build.git ${RBENV_ROOT}/plugins/ruby-build \
&& git clone --depth 1 git://github.com/jf/rbenv-gemset.git ${RBENV_ROOT}/plugins/rbenv-gemset \
&& ${RBENV_ROOT}/plugins/ruby-build/install.sh
RUN echo 'eval "$(rbenv init -)"' >> /etc/profile.d/rbenv.sh
RUN ac_cv_func_isnan=yes ac_cv_func_isinf=yes \
rbenv install ${RUBY_VERSION} \
&& rbenv global ${RUBY_VERSION}
RUN gem install bundler
RUN gem install unf_ext
ENTRYPOINT /bin/bash
Not sure how to fix this with ruby-install... it doesn't offer a configure step.. just a make install...
Found a sufficient set of changes. Might not be optimal, but allows me to build the sensu-plugins-http asset from inside the alpine container. Snippet:
RUN apk add linux-headers build-base zlib-dev openssl-dev wget sudo bash bash-doc bash-completion
RUN wget -O ruby-install-0.7.0.tar.gz https://github.com/postmodern/ruby-install/archive/v0.7.0.tar.gz && \
tar -xzvf ruby-install-0.7.0.tar.gz && \
cd ruby-install-0.7.0/
RUN cd ruby-install-0.7.0/ && ac_cv_func_isnan=yes ac_cv_func_isinf=yes make install
RUN ac_cv_func_isnan=yes ac_cv_func_isinf=yes ruby-install ruby ${RUBY_VERSION} -- --enable-load-relative --disable-install-doc && \
PATH=$PATH:/opt/rubies/ruby-${RUBY_VERSION}/bin/ && gem install --no-ri --no-rdoc ffi
Hello. I'm not sure where to ask for help on this, but I can't a lot of Ruby gems with native extensions.
unf_ext
is just one example, but I think they all error with similar messages.And here's my
Dockerfile
: