chore: better init and test capabilities
This commit is contained in:
@ -18,8 +18,15 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
libyaml-dev \
|
||||
libpq-dev \
|
||||
socat \
|
||||
chromium \
|
||||
chromium-driver \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Selenium/Capybara discover Chrome via these env vars.
|
||||
# chromium-driver installs chromedriver at /usr/bin/chromedriver.
|
||||
ENV CHROME_BIN=/usr/bin/chromium
|
||||
ENV CHROMEDRIVER=/usr/bin/chromedriver
|
||||
|
||||
# --- rbenv (installed into home volume on first run, via entrypoint) ---
|
||||
# RBENV_ROOT points into the home volume so the install persists across rebuilds.
|
||||
ENV RBENV_ROOT=/home/coder/.rbenv
|
||||
|
||||
@ -19,14 +19,37 @@ if [ ! -d "$RBENV_ROOT/bin" ]; then
|
||||
fi
|
||||
eval "$(rbenv init - bash)"
|
||||
|
||||
# Install nvm if not already present in the home volume.
|
||||
if [ ! -s "$NVM_DIR/nvm.sh" ]; then
|
||||
echo "nvm not found — running installer..."
|
||||
curl -fsSL https://raw.githubusercontent.com/nvm-sh/nvm/HEAD/install.sh |
|
||||
NVM_DIR="$NVM_DIR" PROFILE=/dev/null bash
|
||||
echo "nvm installed successfully."
|
||||
# Determine the desired Ruby version: prefer .ruby-version in the workspace,
|
||||
# fall back to the rbenv global setting, then a hardcoded default.
|
||||
if [ -f "/code/.ruby-version" ]; then
|
||||
RUBY_VERSION=$(tr -d '[:space:]' </code/.ruby-version)
|
||||
elif [ -f "$RBENV_ROOT/version" ]; then
|
||||
RUBY_VERSION=$(cat "$RBENV_ROOT/version")
|
||||
else
|
||||
RUBY_VERSION="3.3.6"
|
||||
fi
|
||||
|
||||
# Install the Ruby version if it isn't already built.
|
||||
if ! rbenv versions --bare 2>/dev/null | grep -qx "$RUBY_VERSION"; then
|
||||
echo "Ruby $RUBY_VERSION not found — installing (this may take a few minutes)..."
|
||||
rbenv install "$RUBY_VERSION"
|
||||
echo "Ruby $RUBY_VERSION installed."
|
||||
fi
|
||||
rbenv global "$RUBY_VERSION"
|
||||
|
||||
# Ensure bundler is available for this Ruby version.
|
||||
if ! gem list bundler -i &>/dev/null; then
|
||||
gem install bundler --no-document
|
||||
fi
|
||||
|
||||
# Install gem dependencies for the linked workspace so rspec (and other gems)
|
||||
# are available without needing an explicit `bundle install` step.
|
||||
if [ -f "/code/Gemfile" ]; then
|
||||
echo "Gemfile found — running bundle install..."
|
||||
pushd /code
|
||||
BUNDLE_GEMS__GRAPHQL__PRO="gql_2e0_d66f5103067:70c113ba329" bundle install
|
||||
popd
|
||||
fi
|
||||
. "$NVM_DIR/nvm.sh"
|
||||
|
||||
# Install Claude Code if not already present in the home volume.
|
||||
# Because the home directory is a volume, this install persists across
|
||||
|
||||
Reference in New Issue
Block a user