私はマシンがUbuntuを使用している、コンテナCI環境ではJRubyをアクティブにしようとしている:Linux-3.13.0-91-generic-x86_64-with-Ubuntu-12.04-precise
、特に私はWARファイルを作成されたスクリプトを持っている:奇妙なJRubyの通訳の問題(sで)
#!/bin/bash --login
if [ "$1" == "" ]; then
BUILD_ENV="production"
else
BUILD_ENV="$1"
fi
echo "Building for: $BUILD_ENV"
rvm install jruby-9.1.2.0
rvm use jruby-9.1.2.0
rvm get head
function nightly_ci() {
if [[ "$(python -mplatform)" =~ .*Ubuntu*. ]]; then
export PATH="$PATH:$HOME/.rvm/scripts/rvm"
chmod 755 ~/.rvm ~/.bashrc && echo rvm_autoupdate_flag=0 >> ~/.rvmrc
printf '%s' '[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"' >> ~/.bashrc
fi
}
nightly_ci
# install and package all gems (fixes issues with :gem/:ref gemfile)
echo "bundle install --without development test profile"
bundle install --without development test profile
echo "bundle package --all"
bundle package --all
# build war file, smartroom.war
echo "RAILS_ENV=$BUILD_ENV bundle exec rake assets:precompile"
RAILS_ENV=$BUILD_ENV bundle exec rake assets:precompile --trace
echo "RAILS_ENV=$BUILD_ENV bundle exec warble war"
RAILS_ENV=$BUILD_ENV bundle exec warble war --trace
これはすべてlocalhost上でうまく動作しますが、コンテナ化された環境で実行されますが、JRubyインタプリタがコマンドラインから明示的に呼び出された後にのみ実行されます。
たとえば、JRubyをダウンロードしてスクリプトを実行し、パスが正しく設定されていることを確認し、バンドルが必要な宝石をインストールしてWARを作成します。しかし、これはコンテナ化された環境では動作しません。バンドルインストールでは、ネイティブRubyバージョンのgemを使用し、JRubyに正しいgemをインストールしないからです。スクリプトを実行した後にrvm install jruby-9.1.2.0
と入力すると、JRubyがすでにインストールされていることがわかりますとしたら、スクリプトを再実行すると完全に正常に動作します。自分のbashプロファイルが誤って構成されている可能性があると思っていましたが、そうは思われません。ここでは、コンテナの私のbashrcには、次のとおりです。
source ~/.circlerc &>/dev/null
export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting
# The next line updates PATH for the Google Cloud SDK.
source '/opt/google-cloud-sdk/path.bash.inc'
# The next line enables shell command completion for gcloud.
source '/opt/google-cloud-sdk/completion.bash.inc'
### Added by the Heroku Toolbelt
export PATH="/usr/local/heroku/bin:$PATH"
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
そして、私の.profile:
# if running bash
if [ -n "$BASH_VERSION" ]; then
# include .bashrc if it exists
if [ -f "$HOME/.bashrc" ]; then
. "$HOME/.bashrc"
fi
fi
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
PATH="$HOME/bin:$PATH"
fi
export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
私のJRubyのバージョン:私は経由して行うようjruby 9.1.2.0 (2.3.0) 2016-05-26 7357c8f Java HotSpot(TM) 64-Bit Server VM 24.76-b04 on 1.7.0_76-b13 +jit [linux-x86_64]
は、最後に私は、コマンドの正確なセットを呼び出してみましたスクリプトを終了した後、スクリプトを再実行して、役に立たないようにしてください(夜間ビルド中にWAR生成を自動化しようとしているので、これを実行する必要があります)。私は皆さんにいくつかの洞察力があることを期待していました。