Last active
May 12, 2019 07:31
-
-
Save ndbroadbent/2b03ea2c9c6ed08500cd844234205e55 to your computer and use it in GitHub Desktop.
Ruby Dockerfile with checkinstall (but checkinstall just freezes)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
mkdir -p /tmp/empty | |
docker build -t ruby-package -f Dockerfile.ruby /tmp/empty | |
# Copy deb packages from the built image to ./packages | |
docker run --name temp-package ruby-package /bin/true | |
docker cp temp-package:/packages . | |
docker rm temp-package |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM debian:stretch | |
RUN apt-get update \ | |
&& apt-get install -y \ | |
curl ca-certificates \ | |
checkinstall unzip build-essential \ | |
automake libtool libtool-bin pkg-config \ | |
bison \ | |
dpkg-dev \ | |
gcc \ | |
libbz2-dev \ | |
libgdbm-dev \ | |
libglib2.0-dev \ | |
libncurses-dev \ | |
libreadline-dev \ | |
libxml2-dev \ | |
libxslt-dev \ | |
libjemalloc-dev \ | |
--no-install-recommends | |
ENV RUBY_VERSION=2.5.5 \ | |
RUBY_MAJOR=2.5 \ | |
RUBY_DOWNLOAD_SHA256=9bf6370aaa82c284f193264cc7ca56f202171c32367deceb3599a4f354175d7d | |
# Ruby with jemalloc | |
# Taken from https://github.com/zhulux/debian-ruby-jemalloc/blob/master/Dockerfile | |
# -------------------------------------------------------------------------------- | |
WORKDIR /tmp | |
RUN curl -sfL "https://cache.ruby-lang.org/pub/ruby/${RUBY_MAJOR%-rc}/ruby-$RUBY_VERSION.tar.xz" \ | |
-o ruby.tar.xz | |
RUN sha256sum *ruby.tar.xz \ | |
&& echo "$RUBY_DOWNLOAD_SHA256 *ruby.tar.xz" | sha256sum -c - | |
RUN mkdir -p /usr/src/ruby | |
RUN tar -xJf ruby.tar.xz -C /usr/src/ruby --strip-components=1 | |
WORKDIR /usr/src/ruby | |
# Suppress "warning: Insecure world writable dir" | |
RUN { \ | |
echo '#define ENABLE_PATH_CHECK 0'; \ | |
echo; \ | |
cat file.c; \ | |
} > file.c.new \ | |
&& mv file.c.new file.c | |
RUN autoconf | |
RUN GNU_ARCH="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ | |
&& ./configure \ | |
--build="$GNU_ARCH" \ | |
--disable-install-doc \ | |
--enable-shared \ | |
--with-jemalloc | |
RUN make -j "$(nproc)" | |
RUN checkinstall -d2 -D -y --install=no --fstrans=no \ | |
--nodoc --pkgversion="$RUBY_VERSION" --pakdir=/packages make install | |
# Sanity check for jemalloc | |
RUN ruby --version \ | |
&& ruby -r rbconfig -e "RbConfig::CONFIG['LIBS'].include?('jemalloc') \ | |
? puts('Ruby is compiled with jemalloc.') \ | |
: raise('jemalloc is missing from Ruby!')" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment