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

Running the standalone package inside of a ruby container fails #56

Closed
johnduhart opened this issue Jul 22, 2020 · 5 comments · Fixed by #103
Closed

Running the standalone package inside of a ruby container fails #56

johnduhart opened this issue Jul 22, 2020 · 5 comments · Fixed by #103

Comments

@johnduhart
Copy link

I've encountered something similar to #17, where running the standalone package inside of a container is failing. After spending a few hours troubleshooting I've managed to narrow down the problem. Example dockerfile to reproduce:

FROM ruby:2.6

WORKDIR /opt

RUN curl -LO https://github.com/pact-foundation/pact-ruby-standalone/releases/download/v1.87.5/pact-1.87.5-linux-x86_64.tar.gz \
    && tar xzf pact-1.87.5-linux-x86_64.tar.gz

I'm currently getting the following error:

C:\temp\pact-standalone> docker run --rm -it pact-standalone:latest /opt/pact/bin/pact-mock-service --help
Could not find rake-13.0.1 in any of the sources
Run `bundle install` to install missing gems.

The cause of this appears to be the BUNDLE_APP_CONFIG set on the ruby container. Adding the follow to the Dockerfile fixes the problem:

RUN echo "echo unset BUNDLE_APP_CONFIG" >> /opt/pact/lib/ruby/bin/ruby_environment

I don't know if this is something that needs to be fixed upstream or in this package, but at the very least I wanted to just document this issue for anyone else that may encounter this.

@mefellows
Copy link
Member

Thanks. This is a known issue and is documented somewhere (we've had similar issues with other environment variables). It probably makes sense to explicitly unset this variable in the entry scripts in this repository.

@johnduhart
Copy link
Author

Looks like #50 fixed this, but for batch files.

@YOU54F
Copy link
Member

YOU54F commented May 3, 2023

Hey @johnduhart

Just came across this issue during the upgrade to ruby 3.2.2 as I wanted to use it as a builder image, as it was quicker than builder ruby from source.

## *******************************
## Fails on Ruby:3.2.2 based image - fine on ubuntu latest, but installing ruby 3.2.2 from source takes a good while (few minutes)
## executing ./pact/bin/pactflow
## /tmp/cirrus-ci/working-dir/pkg/pact/lib/ruby/lib/ruby/3.2.0/bundler/definition.rb:524:in `materialize': Could not find pact-1.63.0, pact-message-0.11.1, pact-mock_service-3.11.0, pact-provider-verifier-1.36.1, pact_broker-client-1.66.1, webrick-1.8.1, rack-2.2.7, pact-support-1.19.0, rack-test-2.1.0, rspec-3.12.0, term-ansicolor-1.7.1, thor-1.2)
## from /tmp/cirrus-ci/working-dir/pkg/pact/lib/ruby/lib/ruby/3.2.0/bundler/definition.rb:197:in `specs'
## from /tmp/cirrus-ci/working-dir/pkg/pact/lib/ruby/lib/ruby/3.2.0/bundler/definition.rb:254:in `specs_for'
## from /tmp/cirrus-ci/working-dir/pkg/pact/lib/ruby/lib/ruby/3.2.0/bundler/runtime.rb:18:in `setup'
## from /tmp/cirrus-ci/working-dir/pkg/pact/lib/ruby/lib/ruby/3.2.0/bundler.rb:171:in `setup'
## from /tmp/cirrus-ci/working-dir/pkg/pact/lib/ruby/lib/ruby/3.2.0/bundler/setup.rb:23:in `block in <top (required)>'
## from /tmp/cirrus-ci/working-dir/pkg/pact/lib/ruby/lib/ruby/3.2.0/bundler/ui/shell.rb:159:in `with_level'
## from /tmp/cirrus-ci/working-dir/pkg/pact/lib/ruby/lib/ruby/3.2.0/bundler/ui/shell.rb:111:in `silence'
## from /tmp/cirrus-ci/working-dir/pkg/pact/lib/ruby/lib/ruby/3.2.0/bundler/setup.rb:23:in `<top (required)>'
## from <internal:/tmp/cirrus-ci/working-dir/pkg/pact/lib/ruby/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
## from <internal:/tmp/cirrus-ci/working-dir/pkg/pact/lib/ruby/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
## *******************************

Applying the change to the .sh scripts and solved the error 🚀

@YOU54F
Copy link
Member

YOU54F commented May 3, 2023

Will get it updated, and out :)

@bethesque
Copy link
Member

I would not use the standalone inside of a container. it will be super slow. Much better to actually install ruby and the native gem.

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.

4 participants