Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to create docker image #260

Open
Forage opened this issue Oct 10, 2023 · 2 comments
Open

Unable to create docker image #260

Forage opened this issue Oct 10, 2023 · 2 comments

Comments

@Forage
Copy link

Forage commented Oct 10, 2023

While the latest sources build the image just fine:

STEP 1/4: FROM docker.io/ruby:2.3
Trying to pull docker.io/library/ruby:2.3...
Getting image source signatures
Copying blob 84ed2a0dc034 done  
Copying blob 1b2a72d4e030 done  
Copying blob e79bb959ec00 done  
Copying blob d54db43011fd done  
Copying blob d4b7902036fe done  
Copying blob 69d473365bb3 done  
Copying blob 8952ca0665c5 done  
Copying blob ef485f36c624 done  
Copying config c0d23ebb3e done  
Writing manifest to image destination
Storing signatures
STEP 2/4: COPY . /build
--> 748c52bc0c6
STEP 3/4: RUN cd build &&     bundle install
Fetching gem metadata from https://rubygems.org/.
Resolving dependencies...
Fetching rake 10.5.0
Installing rake 10.5.0
Using bundler 1.17.3
Fetching minitest 5.15.0
Installing minitest 5.15.0
Using wayback_machine_downloader 2.3.1 from source at `.`
Bundle complete! 3 Gemfile dependencies, 4 gems now installed.
Bundled gems are installed into `/usr/local/bundle`
--> d5fd299bcf4
STEP 4/4: ENTRYPOINT [ "/usr/local/bundle/bin/wayback_machine_downloader" ]
COMMIT forage/wayback-machine-downloader
--> cd240010b6a
Successfully tagged localhost/forage/wayback-machine-downloader:latest
cd240010b6a9e44a7fd297b83b53d8cc9fe8c9b6501b709e56833f81181ab7df

Running the resulting image gives the following error:

/usr/local/lib/ruby/site_ruby/2.3.0/rubygems.rb:283:in `find_spec_for_exe': can't find gem wayback_machine_downloader (>= 0.a) with executable wayback_machine_downloader (Gem::GemNotFoundException)
	from /usr/local/lib/ruby/site_ruby/2.3.0/rubygems.rb:302:in `activate_bin_path'
	from /usr/local/bundle/bin/wayback_machine_downloader:23:in `<main>'

gem query --local gives me the list but without wayback-machine-downloader:

*** LOCAL GEMS ***

bigdecimal (default: 1.2.8)
bundler (default: 1.17.3)
did_you_mean (1.0.0)
io-console (default: 0.4.5)
json (default: 1.8.3.1)
minitest (5.15.0, 5.8.5)
net-telnet (0.1.1)
power_assert (0.2.6)
psych (default: 2.1.0.1)
rake (10.5.0, 10.4.2)
rdoc (default: 4.2.1)
rubygems-update (3.0.3)
test-unit (3.1.5)

But this list is identical to the list when running your 5 years old image on docker hub.

The generated files /usr/local/bundle/bin/wayback_machine_downloader between the two version are quite different though:
docker hub image:

#!/usr/bin/env ruby
# frozen_string_literal: true
#
# This file was generated by Bundler.
#
# The application 'wayback_machine_downloader' is installed as part of a gem, and
# this file is here to facilitate running it.
#

require "pathname"
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../../../../build/Gemfile",
  Pathname.new(__FILE__).realpath)

require "rubygems"
require "bundler/setup"

load Gem.bin_path("wayback_machine_downloader", "wayback_machine_downloader")

Mine:

#!/usr/bin/env ruby
#
# This file was generated by RubyGems.
#
# The application 'wayback_machine_downloader' is installed as part of a gem, and
# this file is here to facilitate running it.
#

require 'rubygems'

version = ">= 0.a"

str = ARGV.first
if str
  str = str.b[/\A_(.*)_\z/, 1]
  if str and Gem::Version.correct?(str)
    version = str
    ARGV.shift
  end
end

if Gem.respond_to?(:activate_bin_path)
load Gem.activate_bin_path('wayback_machine_downloader', 'wayback_machine_downloader', version)
else
gem "wayback_machine_downloader", version
load Gem.bin_path("wayback_machine_downloader", "wayback_machine_downloader", version)
end

What could be the cause of the problem?

Forage added a commit to Forage/wayback-machine-downloader that referenced this issue Oct 10, 2023
@Forage
Copy link
Author

Forage commented Oct 10, 2023

Found it. For some reason the Docker file is missing a gem install wayback_machine_downloader. Fixed in PR #261

@Forage
Copy link
Author

Forage commented Oct 11, 2023

Sorry, the above fix is of course flawed. It will simply install the online available gem instead of using the local sources.

Instead, what does work is forcing version 2.3.6 of the ruby image to be used. 2.3.5 was used for the current docker image. 2.3.8 has the error, which is the base when using the current 2.3 tag. It's version 2.3.7 that introduces the problem.
At first I thought it was maybe the rubygem version 3.0.3 which caused the problem, but forcing it back to 2.6.14 with gem update --system 2.6.14 did not help.

I won't be providing a PR for this since it's just a work-around which does not address the underlying problem as to why it no longer works with a more 'recent' ruby image.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant