Skip to content

Commit

Permalink
Use ruby-build
Browse files Browse the repository at this point in the history
  • Loading branch information
ngan committed Apr 9, 2024
1 parent b33ed4f commit f0c2f81
Showing 1 changed file with 38 additions and 11 deletions.
49 changes: 38 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,54 @@ ARG RUBY_VERSION=3.2
# build phase, but not leak into the final image and run phase.
ARG DEBIAN_FRONTEND=noninteractive

RUN apt-get update -qq \
# Install system dependencies.
RUN apt-get update --quiet=2 \
&& apt-get install --quiet --yes \
apt-transport-https \
ca-certificates \
curl \
gnupg

# Install Ruby dependencies.
RUN apt-get update --quiet=2 \
&& apt-get install --yes --no-install-recommends \
autoconf \
bison \
patch \
build-essential \
ca-certificates \
wget \
rustc \
libssl-dev \
libyaml-dev \
libreadline6-dev \
zlib1g-dev \
libgmp-dev \
libncurses5-dev \
libffi-dev \
libgdbm6 \
libgdbm-dev \
libdb-dev \
uuid-dev \
# Other dependencies...
default-libmysqlclient-dev \
clang clang-tools \
clang \
clang-tools \
llvm \
valgrind \
netcat

RUN update-ca-certificates

RUN wget https://github.com/postmodern/ruby-install/releases/download/v0.9.0/ruby-install-0.9.0.tar.gz \
&& tar -xzvf ruby-install-0.9.0.tar.gz \
&& cd ruby-install-0.9.0 \
&& make install

RUN ruby-install --system ruby ${RUBY_VERSION}
RUN ruby --version
RUN if which ruby >/dev/null 2>&1; then \
echo "Ruby is already installed: $(ruby --version)"; \
else \
curl --location \
"https://github.com/rbenv/ruby-build/archive/refs/tags/$(basename $(curl --location --silent --output /dev/null --write-out %{url_effective} https://github.com/rbenv/ruby-build/releases/latest)).tar.gz" \
| tar --extract --gzip \
&& PREFIX=/usr/local ./ruby-build-*/install.sh \
&& rm -rf ./ruby-build-*/install.sh \
&& ruby-build ${RUBY_VERSION}.0 /usr/local \
&& echo "Installed Ruby: $(ruby --version)"; \
fi

WORKDIR /app
COPY . .
Expand Down

0 comments on commit f0c2f81

Please sign in to comment.