From df9bda6e35088b6b24b9c4dd1017988d9a07d259 Mon Sep 17 00:00:00 2001 From: Lexical Bits Date: Mon, 4 May 2026 09:53:00 -0400 Subject: [PATCH] chore: better init and test capabilities --- Dockerfile | 7 +++++++ entrypoint.sh | 37 ++++++++++++++++++++++++++++++------- 2 files changed, 37 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index e260253..b7d0370 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 diff --git a/entrypoint.sh b/entrypoint.sh index 5597f99..f29fc3e 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -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:]' /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