# Base image for building Solargraph from source
FROM ruby:slim-bookworm
# Install system dependencies required for building gems with native extensions
RUN apt-get update -y \
&& apt-get install -y --no-install-recommends \
git \
build-essential \
patch \
ruby-dev \
zlib1g-dev \
liblzma-dev \
libxml2-dev \
libxslt1-dev \
&& rm -rf /var/lib/apt/lists/*
# Install Bundler >= 2.0 to satisfy gemspec bundler requirements
RUN gem install bundler -v '>= 2.0' --no-document
# Set work directory for the build
WORKDIR /solargraph
# Copy Gemfile and gemspec first to leverage Docker layer caching
COPY Gemfile Gemfile
COPY solargraph.gemspec solargraph.gemspec
# Install project dependencies and prepare the gem from the local gemspec
RUN bundle install
# Build the gem from source
RUN bundle exec rake build
# Install the built gem into the image so the 'solargraph' executable is available
RUN gem install ./*.gem
# Ensure the Bundler bin directory is in PATH so the 'solargraph' executable is discoverable
ENV PATH="/usr/local/bundle/bin:${PATH}"
# Default command to run the Solargraph CLI
CMD ["solargraph"]
git .git .bundle vendor/bundle node_modules coverage spec test tmp log *.gem .env .envrc .DS_Store .vscode .idea
Concerns: Does not copy the actual source code into the image; only Gemfile and gemspec are copied. 'bundle exec rake build' requires source files to build the gem from source, so the build will fail., Missing a COPY . . (or equivalent) to bring in the repository sources; without the code, the gem cannot be built from source.
# Base image for building Solargraph from source
FROM ruby:slim-bookworm
# Install system dependencies required for building gems with native extensions
RUN apt-get update -y \
&& apt-get install -y --no-install-recommends \
git \
build-essential \
patch \
ruby-dev \
zlib1g-dev \
liblzma-dev \
libxml2-dev \
libxslt1-dev \
&& rm -rf /var/lib/apt/lists/*
# Install Bundler >= 2.0 to satisfy gemspec bundler requirements
RUN gem install bundler -v '>= 2.0' --no-document
# Set work directory for the build
WORKDIR /solargraph
# Copy Gemfile and gemspec first to leverage Docker layer caching
COPY Gemfile Gemfile
COPY solargraph.gemspec solargraph.gemspec
# Install project dependencies
RUN bundle install
# Copy the rest of the source code
COPY . .
# Build the gem from source
RUN bundle exec rake build
# Install the built gem into the image so the 'solargraph' executable is available
RUN gem install ./*.gem
# Ensure the Bundler bin directory is in PATH so the 'solargraph' executable is discoverable
ENV PATH="/usr/local/bundle/bin:${PATH}"
# Default command to run the Solargraph CLI
CMD ["solargraph"]
- Exact error message and exit code
- [!] There was an error while loading `solargraph.gemspec`: cannot load such file -- solargraph/version. Bundler cannot continue.
from /solargraph/solargraph.gemspec:2
-------------------------------------------
$LOAD_PATH.unshift File.dirname(__FILE__) + '/lib'
> require 'solargraph/version'
# require 'date'
-------------------------------------------
- ERROR: process "/bin/sh -c bundle install" did not complete successfully: exit code: 14
- Failing command/step
- [7/10] RUN bundle install
- Missing packages or files mentioned
- Missing file: solargraph/version (cannot load such file -- solargraph/version) referenced by solargraph.gemspec
- Context: solargraph.gemspec at /solargraph/solargraph.gemspec requires solargraph/version
- Version mismatch information
- Bundler installed: bundler-4.0.8 (Successfully installed)
- Ruby environment: ruby3.1 (from Debian bookworm image)
- No explicit version mismatch noted; the failure is due to a missing file, not a mismatched version
- Quick notes to fix
- Ensure solargraph/version.rb exists in the Solargraph source/gem being built and is included in the gemspec load path.
- Verify the build context includes all Solargraph gem files referenced by solargraph.gemspec, and that require 'solargraph/version' resolves correctly during bundle install.# Base image for building Solargraph from source
FROM ruby:slim-bookworm
# Install system dependencies required for building gems with native extensions
RUN apt-get update -y \
&& apt-get install -y --no-install-recommends \
git \
build-essential \
patch \
ruby-dev \
zlib1g-dev \
liblzma-dev \
libxml2-dev \
libxslt1-dev \
&& rm -rf /var/lib/apt/lists/*
# Install Bundler >= 2.0 to satisfy gemspec bundler requirements
RUN gem install bundler -v '>= 2.0' --no-document
# Set work directory for the build
WORKDIR /solargraph
# Copy Gemfile and gemspec first to leverage Docker layer caching
COPY Gemfile Gemfile
COPY solargraph.gemspec solargraph.gemspec
# Copy the rest of the source code so that git ls-files works and lib files exist
COPY . .
# Install project dependencies
RUN bundle install
# Build the gem from source
RUN bundle exec rake build
# Install the built gem into the image so the 'solargraph' executable is available
RUN gem install ./*.gem
# Ensure the Bundler bin directory is in PATH so the 'solargraph' executable is discoverable
ENV PATH="/usr/local/bundle/bin:${PATH}"
# Default command to run the Solargraph CLI
CMD ["solargraph"]
Summary: - Build status: VerifyBuild status: build_failed - Failing step: RUN bundle install (Step [8/10]). Exit code: 5 Exact errors and context: - psych gem failure - Directory: /usr/local/bundle/gems/psych-5.3.1/ext/psych - Command: /usr/local/bin/ruby extconf.rb - Issues: yaml.h not found; pkg-config for yaml-0.1 not found - Result: Could not create Makefile; An error occurred while installing psych (5.3.1); Bundler cannot continue. - rugged gem failure - Directory: /usr/local/bundle/gems/rugged-1.9.0/ext/rugged - Command: /usr/local/bin/ruby extconf.rb - Issues: cmake not found; GMake available - Result: CMake is required to build Rugged; Could not create Makefile; An error occurred while installing rugged (1.9.0); Bundler cannot continue. - Gemfile note: undercover resolved to 0.8.4, which depends on rugged Final result: - ERROR: process "/bin/sh -c bundle install" did not complete successfully: exit code: 5 Missing packages/files referenced: - yaml.h not found (missing YAML development headers) - pkg-config for yaml-0.1 not found - cmake (required to build rugged) - libyaml development headers (inferred from yaml.h absence) Version/mismatch notes: - Log paths indicate Ruby 4.0.0 (e.g., extensions/x86_64-linux/4.0.0/...), suggesting Ruby 4.x in use - Some gems (psych, rugged) may not be fully compatible or prebuilt for Ruby 4 yet, contributing to native-extension failures alongside missing build tooling - Gem/dep chain: psych (for rdoc) and rugged (via undercover) fail installation; dependencies trigger these failures Actions suggested: - Install missing build headers/tools in Dockerfile, e.g.: - apt-get install -y pkg-config cmake libyaml-dev - Ensure YAML development headers are present (libyaml-dev) so yaml.h is available - Consider pinning a Ruby version known to be compatible with these gem versions, or adjust gem versions - Rebuild after adding these packages
# Base image for building Solargraph from source
FROM ruby:slim-bookworm
# Install system dependencies required for building gems with native extensions
RUN apt-get update -y \
&& apt-get install -y --no-install-recommends \
git \
build-essential \
patch \
ruby-dev \
zlib1g-dev \
liblzma-dev \
libxml2-dev \
libxslt1-dev \
pkg-config \
cmake \
libyaml-dev \
&& rm -rf /var/lib/apt/lists/*
# Install Bundler >= 2.0 to satisfy gemspec bundler requirements
RUN gem install bundler -v '>= 2.0' --no-document
# Set work directory for the build
WORKDIR /solargraph
# Copy Gemfile and gemspec first to leverage Docker layer caching
COPY Gemfile Gemfile
COPY solargraph.gemspec solargraph.gemspec
# Copy the rest of the source code so that git ls-files works and lib files exist
COPY . .
# Install project dependencies
RUN bundle install
# Build the gem from source
RUN bundle exec rake build
# Install the built gem into the image so the 'solargraph' executable is available
RUN gem install ./*.gem
# Ensure the Bundler bin directory is in PATH so the 'solargraph' executable is discoverable
ENV PATH="/usr/local/bundle/bin:${PATH}"
# Default command to run the Solargraph CLI
CMD ["solargraph"]
Summary (under 1500 chars):
- Exact error message and exit code
- Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
- An error occurred while installing rugged (1.9.0), and Bundler cannot continue.
- In Gemfile:
undercover was resolved to 0.8.4, which depends on
rugged
- Docker exit: process "/bin/sh -c bundle install" did not complete successfully: exit code: 5
- Failing command/step
- [8/10] RUN bundle install
- Missing packages or files mentioned
- Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the system variable OPENSSL_ROOT_DIR (missing: OPENSSL_CRYPTO_LIBRARY OPENSSL_INCLUDE_DIR)
- Could NOT find GSSAPI (missing: GSSAPI_LIBRARIES GSSAPI_INCLUDE_DIR)
- Package 'heimdal-gssapi', required by 'virtual:world', not found
- Version mismatch / compatibility notes
- The failure occurs while building rugged (1.9.0), which Bundler attempts to install as a transitive dependency of undercover (0.8.4). The build cannot proceed because an HTTPS/OpenSSL backend could not be autodetected due to missing OpenSSL libraries, i.e., OpenSSL support is not present in the environment. This is the root cause of the rugged gem native-extension build failure, not a simple version mismatch.# Base image for building Solargraph from source
FROM ruby:slim-bookworm
# Install system dependencies required for building gems with native extensions
RUN apt-get update -y \
&& apt-get install -y --no-install-recommends \
git \
build-essential \
patch \
ruby-dev \
zlib1g-dev \
liblzma-dev \
libxml2-dev \
libxslt1-dev \
pkg-config \
cmake \
libyaml-dev \
libssl-dev \
libgit2-dev \
libcurl4-openssl-dev \
&& rm -rf /var/lib/apt/lists/*
# Install Bundler >= 2.0 to satisfy gemspec bundler requirements
RUN gem install bundler -v '>= 2.0' --no-document
# Set work directory for the build
WORKDIR /solargraph
# Copy Gemfile and gemspec first to leverage Docker layer caching
COPY Gemfile Gemfile
COPY solargraph.gemspec solargraph.gemspec
# Copy the rest of the source code so that git ls-files works and lib files exist
COPY . .
# Install project dependencies
RUN bundle install
# Build the gem from source
RUN bundle exec rake build
# Install the built gem into the image so the 'solargraph' executable is available
RUN gem install ./*.gem
# Ensure the Bundler bin directory is in PATH so the 'solargraph' executable is discoverable
ENV PATH="/usr/local/bundle/bin:${PATH}"
# Default command to run the Solargraph CLI
CMD ["solargraph"]
Summary (under 1500 chars): - Exact error message and exit code - ERROR: Could not find a valid gem './*.gem' (>= 0) in any repository - Exited with code: 2 - Failing command/step: RUN gem install ./*.gem (Dockerfile:43) at step [10/10] - Failing command/step details - Step 10/10: RUN gem install ./*.gem - The image attempted to install a gem from the current directory using a glob pattern. - Missing files or path mismatches mentioned - The build produced the SolarGraph gem at pkg/solargraph-0.58.3.gem (visible from: “solargraph 0.58.3 built to pkg/solargraph-0.58.3.gem.” in step 13). - The failing install command uses the glob ./*.gem, which requires a gem file in the working directory, but the built gem is not present there (it's in pkg/). - Therefore, no valid gem matched by ./*.gem, causing the error. - Version/mismatch information - Built gem version: solargraph-0.58.3 (step 13) - Build environment includes Ruby 3.1 (Ruby 1:3.1, from apt install) and Bundler 4.0.8 (step 7) - The mismatch is not a gem version issue but a file-path mismatch: the gem is in pkg/, not in the root for the final installation step.
# Base image for building Solargraph from source
FROM ruby:slim-bookworm
# Install system dependencies required for building gems with native extensions
RUN apt-get update -y \
&& apt-get install -y --no-install-recommends \
git \
build-essential \
patch \
ruby-dev \
zlib1g-dev \
liblzma-dev \
libxml2-dev \
libxslt1-dev \
pkg-config \
cmake \
libyaml-dev \
libssl-dev \
libgit2-dev \
libcurl4-openssl-dev \
&& rm -rf /var/lib/apt/lists/*
# Install Bundler >= 2.0 to satisfy gemspec bundler requirements
RUN gem install bundler -v '>= 2.0' --no-document
# Set work directory for the build
WORKDIR /solargraph
# Copy Gemfile and gemspec first to leverage Docker layer caching
COPY Gemfile Gemfile
COPY solargraph.gemspec solargraph.gemspec
# Copy the rest of the source code so that git ls-files works and lib files exist
COPY . .
# Install project dependencies
RUN bundle install
# Build the gem from source
RUN bundle exec rake build
# Install the built gem into the image so the 'solargraph' executable is available
RUN mkdir -p /opt/solargraph
RUN cp pkg/solargraph-*.gem /opt/solargraph/
RUN gem install /opt/solargraph/solargraph-*.gem
# Ensure the Bundler bin directory is in PATH so the 'solargraph' executable is discoverable
ENV PATH="/usr/local/bundle/bin:${PATH}"
# Default command to run the Solargraph CLI
CMD ["solargraph"]
Smoke [PASS]: command -v solargraph Smoke [PASS]: solargraph --help