Add option to pass custom bundler version

This commit is contained in:
Andrejs Cunskis 2022-05-01 19:31:13 +03:00
parent 34bf5cf7ee
commit 1f15ec8684
No known key found for this signature in database
GPG key ID: 87CB75083F227241
5 changed files with 24 additions and 2 deletions

View file

@ -4,6 +4,7 @@
LFS: '2.9'
GIT: '2.33'
RUBY: '2.7'
BUNDLER: '2.3'
CHROME: '99'
GCLOUD: '383'
KUBECTL: '1.23'

View file

@ -16,8 +16,9 @@ ENV PATH $PATH:/usr/local/go/bin
# Ruby
ARG RUBY_VERSION
ARG RUBY_DOWNLOAD_SHA256
ARG BUNDLER_VERSION
RUN if [ -n "$RUBY_VERSION" ]; then /scripts/install-ruby $RUBY_VERSION $RUBY_DOWNLOAD_SHA256 && ruby --version; fi
RUN if [ -n "$RUBY_VERSION" ]; then /scripts/install-ruby $RUBY_VERSION $RUBY_DOWNLOAD_SHA256 $BUNDLER_VERSION && ruby --version; fi
# Git
ARG GIT_VERSION

View file

@ -215,6 +215,20 @@ function print_ruby_args() {
printf -- "--build-arg RUBY_DOWNLOAD_SHA256=%s " "$RUBY_DOWNLOAD_SHA256"
}
function print_bundler_args() {
case "$1" in
2.1)
BUNDLER_VERSION=2.1.4
;;
2.3)
BUNDLER_VERSION=2.3.12
;;
*) echo "Unknown bundler version $1"; exit 1;
esac
printf -- "--build-arg BUNDLER_VERSION=%s " "$BUNDLER_VERSION"
}
function print_gcloud_args() {
case "$1" in
383)
@ -252,6 +266,7 @@ function parse_arguments() {
case "$tool" in
DEBIAN) CUSTOM_IMAGE_VERSION=$version ;;
RUBY) print_ruby_args $version ;;
BUNDLER) print_bundler_args $version ;;
GOLANG) print_golang_args $version ;;
CHROME) print_chrome_args $version ;;
DOCKER) print_docker_args $version ;;

View file

@ -13,6 +13,8 @@ JEMALLOC_VERSION=5.2.1
JEMALLOC_DOWNLOAD_SHA256="34330e5ce276099e2e8950d9335db5a875689a4c6a56751ef3b1d8c537f887f6"
JEMALLOC_DOWNLOAD_URL="https://github.com/jemalloc/jemalloc/releases/download/${JEMALLOC_VERSION}/jemalloc-${JEMALLOC_VERSION}.tar.bz2"
BUNDLER_VERSION=${3:-""}
# Install needed packages
apt-get update
apt-get install -y --no-install-recommends bison dpkg-dev libgdbm-dev autoconf
@ -60,6 +62,9 @@ export LDFLAGS="-Wl,--no-as-needed"
cflags="-fno-omit-frame-pointer" ./configure --enable-shared --with-jemalloc --disable-install-doc --disable-install-rdoc --disable-install-capi
make install -j $(nproc)
# Install specific version of bundler if provided
if [[ "$BUNDLER_VERSION" != "" ]]; then gem install bundler -v $BUNDLER_VERSION; fi
# Cleanup
cd /
rm -rf /usr/src/ruby /usr/src/jemalloc

View file

@ -1,4 +1,4 @@
TOOLS=(DEBIAN RUBY GOLANG GIT LFS CHROME NODE YARN POSTGRESQL GRAPHICSMAGICK PGBOUNCER BAZELISK GCLOUD KUBECTL)
TOOLS=(DEBIAN RUBY BUNDLER GOLANG GIT LFS CHROME NODE YARN POSTGRESQL GRAPHICSMAGICK PGBOUNCER BAZELISK GCLOUD KUBECTL)
function get_image_name(){
local IMAGE_NAME