mirror of
https://ops.gitlab.net/gitlab-org/gitlab-build-images.git
synced 2025-12-09 10:02:56 +01:00
Apply thread allocations patch to Ruby 2.7
This makes us to compile Ruby 2.7 manually and apply relevant patch.
This commit is contained in:
parent
28db6ad94c
commit
d25cb10067
4 changed files with 78 additions and 26 deletions
|
|
@ -5,6 +5,7 @@ default:
|
|||
before_script:
|
||||
- docker login -u "gitlab-ci-token" -p "$CI_JOB_TOKEN" "$CI_REGISTRY"
|
||||
- source scripts/build-helpers.sh
|
||||
- apk add -U bash
|
||||
tags:
|
||||
- gitlab-org-docker
|
||||
|
||||
|
|
|
|||
|
|
@ -13,6 +13,12 @@ RUN /scripts/install-essentials
|
|||
|
||||
ENV PATH $PATH:/usr/local/go/bin
|
||||
|
||||
# Ruby
|
||||
ARG RUBY_VERSION
|
||||
ARG RUBY_DOWNLOAD_SHA256
|
||||
|
||||
RUN if [ -n "$RUBY_VERSION" ]; then /scripts/install-ruby $RUBY_VERSION $RUBY_DOWNLOAD_SHA256 && ruby --version; fi
|
||||
|
||||
# Git
|
||||
ARG GIT_VERSION
|
||||
ARG GIT_DOWNLOAD_URL
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#!/bin/sh
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
IFS=$'\n\t'
|
||||
|
|
@ -228,29 +228,38 @@ function print_pgbouncer_args() {
|
|||
printf -- "--build-arg PGBOUNCER_DOWNLOAD_SHA256=%s " "$PGBOUNCER_DOWNLOAD_SHA256"
|
||||
}
|
||||
|
||||
function parse_arguments() {
|
||||
read base
|
||||
read base_version
|
||||
function print_ruby_args() {
|
||||
case "$1" in
|
||||
2.6.*)
|
||||
CUSTOM_IMAGE_NAME=debian
|
||||
CUSTOM_IMAGE_VERSION=stretch
|
||||
RUBY_VERSION="2.6.6"
|
||||
RUBY_DOWNLOAD_SHA256="5db187882b7ac34016cd48d7032e197f07e4968f406b0690e20193b9b424841f"
|
||||
;;
|
||||
|
||||
# Lock Ruby to Debian version to pin OpenSSL version
|
||||
case "$base" in
|
||||
ruby)
|
||||
case "$base_version" in
|
||||
2.6.*)
|
||||
base_version="$base_version-stretch"
|
||||
;;
|
||||
*)
|
||||
base_version="$base_version-buster"
|
||||
;;
|
||||
esac
|
||||
2.7.*)
|
||||
CUSTOM_IMAGE_NAME=debian
|
||||
CUSTOM_IMAGE_VERSION=buster
|
||||
RUBY_VERSION="2.7.2"
|
||||
RUBY_DOWNLOAD_SHA256="1b95ab193cc8f5b5e59d2686cb3d5dcf1ddf2a86cb6950e0b4bdaae5040ec0d6"
|
||||
;;
|
||||
|
||||
*) echo "Unknown ruby version $1"; exit 1;
|
||||
esac
|
||||
|
||||
printf -- "-f Dockerfile.custom " "$base"
|
||||
printf -- "--build-arg CUSTOM_IMAGE_NAME=%s " "$base"
|
||||
printf -- "--build-arg CUSTOM_IMAGE_VERSION=%s " "$base_version"
|
||||
printf -- "--build-arg CUSTOM_IMAGE_NAME=%s " "$CUSTOM_IMAGE_NAME"
|
||||
printf -- "--build-arg CUSTOM_IMAGE_VERSION=%s " "$CUSTOM_IMAGE_VERSION"
|
||||
printf -- "--build-arg RUBY_VERSION=%s " "$RUBY_VERSION"
|
||||
printf -- "--build-arg RUBY_DOWNLOAD_SHA256=%s " "$RUBY_DOWNLOAD_SHA256"
|
||||
}
|
||||
|
||||
function parse_arguments() {
|
||||
printf -- "-f Dockerfile.custom "
|
||||
|
||||
while read image; do
|
||||
read version
|
||||
case "$image" in
|
||||
ruby) print_ruby_args $version ;;
|
||||
golang) print_golang_args $version ;;
|
||||
chrome) print_chrome_args $version ;;
|
||||
docker) print_docker_args $version ;;
|
||||
|
|
|
|||
|
|
@ -1,14 +1,50 @@
|
|||
#!/bin/bash
|
||||
set -xeuo pipefail
|
||||
IFS=$'\n\t'
|
||||
|
||||
cd /tmp
|
||||
wget http://cache.ruby-lang.org/pub/ruby/2.2/ruby-2.2.2.tar.gz
|
||||
tar -xvzf ruby-2.2.2.tar.gz
|
||||
set -xeou pipefail
|
||||
|
||||
cd ruby-2.2.2
|
||||
# Based on https://github.com/docker-library/ruby/blob/master/2.7/buster/Dockerfile
|
||||
|
||||
RUBY_VERSION=${1}
|
||||
RUBY_MAJOR=${1%.*} # strip last component
|
||||
RUBY_DOWNLOAD_SHA256=${2}
|
||||
|
||||
RUBY_DOWNLOAD_URL="https://cache.ruby-lang.org/pub/ruby/${RUBY_MAJOR%-rc}/ruby-$RUBY_VERSION.tar.xz"
|
||||
|
||||
# Download Ruby
|
||||
curl -fsSL "$RUBY_DOWNLOAD_URL" -o ruby.tar.xz
|
||||
echo "${RUBY_DOWNLOAD_SHA256} ruby.tar.xz" | sha256sum -c -
|
||||
|
||||
# Skip installing Gem docs
|
||||
mkdir -p /usr/local/etc
|
||||
echo 'install: --no-document' >> /usr/local/etc/gemrc
|
||||
echo 'update: --no-document' >> /usr/local/etc/gemrc
|
||||
|
||||
# Install needed packages
|
||||
apt-get update
|
||||
apt-get install -y --no-install-recommends bison dpkg-dev libgdbm-dev ruby
|
||||
|
||||
# Unpack Ruby
|
||||
mkdir -p /usr/src/ruby
|
||||
tar -xJf ruby.tar.xz -C /usr/src/ruby --strip-components=1
|
||||
rm ruby.tar.xz
|
||||
cd /usr/src/ruby
|
||||
|
||||
# Apply patches
|
||||
find /patches/ruby/$RUBY_VERSION -name '*.patch' -print0 | xargs -0 -n1 patch -p1 -i
|
||||
./configure --enable-shared --disable-install-doc --disable-install-rdoc --disable-install-capi
|
||||
make install -j 3
|
||||
make install -j $(nproc)
|
||||
|
||||
# Cleanup
|
||||
cd /
|
||||
rm -rf /tmp/*
|
||||
rm -rf /usr/src/ruby
|
||||
apt-get purge -y --auto-remove ruby
|
||||
|
||||
# Verify
|
||||
# verify we have no "ruby" packages installed
|
||||
! dpkg -l | grep -i ruby
|
||||
[ "$(command -v ruby)" = '/usr/local/bin/ruby' ]
|
||||
|
||||
# rough smoke test
|
||||
ruby --version
|
||||
gem --version
|
||||
bundle --version
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue