arvbox updates for ruby and bundler, refs #21301
[arvados.git] / tools / arvbox / lib / arvbox / docker / common.sh
index ba81426f0bfc35a7b916496970edf0cbb9648300..9c5df83c0e91b25f523531a5512b7efa00c2370f 100644 (file)
@@ -2,8 +2,8 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-export RUBY_VERSION=2.7.0
-export BUNDLER_VERSION=2.2.19
+export RUBY_VERSION=3.2.2
+export BUNDLER_VERSION=2.4.22
 
 export DEBIAN_FRONTEND=noninteractive
 export PATH=${PATH}:/usr/local/go/bin:/var/lib/arvados/bin:/usr/src/arvados/sdk/cli/binstubs
@@ -15,6 +15,10 @@ export ARVADOS_CONTAINER_PATH=/var/lib/arvados-arvbox
 export GEM_HOME=$HOME/.gem
 GEMLOCK=$HOME/gems.lock
 
+export LANG=en_US.UTF-8
+export LANGUAGE=en_US:en
+export LC_ALL=en_US.UTF-8
+
 defaultdev=$(/sbin/ip route|awk '/default/ { print $5 }')
 dockerip=$(/sbin/ip route | grep default | awk '{ print $3 }')
 containerip=$(ip addr show $defaultdev | grep 'inet ' | sed 's/ *inet \(.*\)\/.*/\1/')
@@ -31,9 +35,8 @@ server_cert_key=$ARVADOS_CONTAINER_PATH/server-cert-${localip}.key
 
 declare -A services
 services=(
-  [workbench]=443
   [workbench2]=3000
-  [workbench2-ssl]=3001
+  [workbench2-ssl]=443
   [api]=8004
   [controller]=8003
   [controller-ssl]=8000
@@ -64,24 +67,38 @@ fi
 
 run_bundler() {
     flock $GEMLOCK /var/lib/arvados/bin/gem install --no-document --user bundler:$BUNDLER_VERSION
-    if test -f Gemfile.lock ; then
-        frozen=--frozen
-    else
-        frozen=""
-    fi
+
     BUNDLER=bundle
     if test -x $PWD/bin/bundle ; then
-       # If present, use the one associated with rails workbench or API
+       # If present, use the one associated with rails API
        BUNDLER=$PWD/bin/bundle
     fi
 
+    # Use Gemfile.lock only if it is git tracked.
+    if git ls-files --error-unmatch Gemfile.lock ; then
+       flock $GEMLOCK $BUNDLER config set --local frozen true
+    else
+       flock $GEMLOCK $BUNDLER config set --local frozen false
+    fi
+    flock $GEMLOCK $BUNDLER config set --local deployment false
+
     if test -z "$(flock $GEMLOCK /var/lib/arvados/bin/gem list | grep 'arvados[[:blank:]].*[0-9.]*dev')" ; then
         (cd /usr/src/arvados/sdk/ruby && \
         /var/lib/arvados/bin/gem build arvados.gemspec && flock $GEMLOCK /var/lib/arvados/bin/gem install $(ls -1 *.gem | sort -r | head -n1))
     fi
-    if ! flock $GEMLOCK $BUNDLER install --verbose --local --no-deployment $frozen "$@" ; then
-        flock $GEMLOCK $BUNDLER install --verbose --no-deployment $frozen "$@"
+
+    if ! flock $GEMLOCK $BUNDLER install --verbose --local "$@" ; then
+        flock $GEMLOCK $BUNDLER install --verbose "$@"
+    fi
+}
+
+bundler_binstubs() {
+    BUNDLER=bundle
+    if test -x $PWD/bin/bundle ; then
+       # If present, use the one associated with rails API
+       BUNDLER=$PWD/bin/bundle
     fi
+    flock $GEMLOCK $BUNDLER binstubs --all
 }
 
 PYCMD=""