diff --git a/.github/workflows/linux-build.yml b/.github/workflows/linux-build.yml index af7369d..41978c4 100644 --- a/.github/workflows/linux-build.yml +++ b/.github/workflows/linux-build.yml @@ -17,7 +17,7 @@ jobs: matrix: mysql: ["5.7", "8.0"] distribution: ["debian:buster", "ubuntu:focal", "ubuntu:bionic"] - ruby: ["3.3"] + ruby: ["3.3.0"] include: - mysql: "5.7" distribution: "debian:buster" diff --git a/Dockerfile b/Dockerfile index d100618..2d281aa 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,27 +7,53 @@ 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 \ + libreadline-dev \ + zlib1g-dev \ + libgmp-dev \ + libncurses-dev \ + libffi-dev \ + 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} /usr/local \ + && echo "Installed Ruby: $(ruby --version)"; \ + fi WORKDIR /app COPY . .