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 \
|
libyaml-dev \
|
||||||
libpq-dev \
|
libpq-dev \
|
||||||
socat \
|
socat \
|
||||||
|
chromium \
|
||||||
|
chromium-driver \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& 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 (installed into home volume on first run, via entrypoint) ---
|
||||||
# RBENV_ROOT points into the home volume so the install persists across rebuilds.
|
# RBENV_ROOT points into the home volume so the install persists across rebuilds.
|
||||||
ENV RBENV_ROOT=/home/coder/.rbenv
|
ENV RBENV_ROOT=/home/coder/.rbenv
|
||||||
|
|||||||
@ -19,14 +19,37 @@ if [ ! -d "$RBENV_ROOT/bin" ]; then
|
|||||||
fi
|
fi
|
||||||
eval "$(rbenv init - bash)"
|
eval "$(rbenv init - bash)"
|
||||||
|
|
||||||
# Install nvm if not already present in the home volume.
|
# Determine the desired Ruby version: prefer .ruby-version in the workspace,
|
||||||
if [ ! -s "$NVM_DIR/nvm.sh" ]; then
|
# fall back to the rbenv global setting, then a hardcoded default.
|
||||||
echo "nvm not found — running installer..."
|
if [ -f "/code/.ruby-version" ]; then
|
||||||
curl -fsSL https://raw.githubusercontent.com/nvm-sh/nvm/HEAD/install.sh |
|
RUBY_VERSION=$(tr -d '[:space:]' </code/.ruby-version)
|
||||||
NVM_DIR="$NVM_DIR" PROFILE=/dev/null bash
|
elif [ -f "$RBENV_ROOT/version" ]; then
|
||||||
echo "nvm installed successfully."
|
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
|
fi
|
||||||
. "$NVM_DIR/nvm.sh"
|
|
||||||
|
|
||||||
# Install Claude Code if not already present in the home volume.
|
# Install Claude Code if not already present in the home volume.
|
||||||
# Because the home directory is a volume, this install persists across
|
# Because the home directory is a volume, this install persists across
|
||||||
|
|||||||
Reference in New Issue
Block a user