diff options
| author | mo khan <mo.khan@gmail.com> | 2020-04-14 23:08:18 -0600 |
|---|---|---|
| committer | mo khan <mo.khan@gmail.com> | 2020-04-14 23:08:18 -0600 |
| commit | c907207701c5789ee8bc9eb92494806a9d5d15d3 (patch) | |
| tree | 617ec5f39d3f6102e644442f101683e3b8576efc | |
| parent | bdcc78c5944b1cfa14f7d92276cc0658f415e60c (diff) | |
Build a smaller ruby image
| -rw-r--r-- | Dockerfile | 9 | ||||
| -rw-r--r-- | config/install.sh | 15 |
2 files changed, 17 insertions, 7 deletions
@@ -1,4 +1,11 @@ -FROM debian:stable-slim +FROM debian:stable-slim as ruby-builder +ENV PATH="/opt/ruby/bin:${HOME}/.local/bin:${PATH}" WORKDIR /root COPY config /root RUN bash /root/install.sh + +FROM debian:stable-slim +ENV PATH="/opt/ruby/bin:${HOME}/.local/bin:${PATH}" +ENV RUBYLIB="/opt/spandx-gitlab/lib" +RUN apt-get update -y && apt-get install -y libgdbm6 wget libssl1.1 libyaml-0-2 libreadline7 +COPY --from=ruby-builder /opt/ruby /opt/ruby diff --git a/config/install.sh b/config/install.sh index eadeca6..554188c 100644 --- a/config/install.sh +++ b/config/install.sh @@ -6,18 +6,21 @@ export DEBIAN_FRONTEND=noninteractive apt-get clean apt-get update -q apt-get install -y wget apt-utils libedit2 git -apt-get install -y autoconf bison build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm6 libgdbm-dev +apt-get install -y autoconf bison build-essential libssl-dev libyaml-dev libreadline-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm6 libgdbm-dev cd /root wget https://cache.ruby-lang.org/pub/ruby/2.7/ruby-2.7.1.tar.gz tar -xf ruby-2.7.1.tar.gz cd ruby-2.7.1 - -./configure --disable-install-doc --disable-install-rdoc --disable-install-capi --disable-dln --with-static-linked-ext --without-valgrind --disable-jit-support +./configure --prefix=/opt/ruby --disable-install-doc --disable-install-rdoc --disable-install-capi --disable-dln --with-static-linked-ext --without-valgrind --disable-jit-support --disable-rubygems make -j"$(nproc)" make install +rm -r /opt/ruby/share + cd /root -rm -fr ruby-2.7.1* -gem update --system -gem install bundler -v '~> 2.0' +wget https://rubygems.org/rubygems/rubygems-3.1.2.tgz +tar -xf rubygems-3.1.2.tgz +cd rubygems-3.1.2 +ruby setup.rb +gem install spandx echo "Done" |
