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

Pact-ruby-standalone not compatible with alpine glibc-2.35-r0 #96

Closed
3 tasks done
bhasden opened this issue Mar 29, 2023 · 4 comments
Closed
3 tasks done

Pact-ruby-standalone not compatible with alpine glibc-2.35-r0 #96

bhasden opened this issue Mar 29, 2023 · 4 comments

Comments

@bhasden
Copy link

bhasden commented Mar 29, 2023

Pre issue-raising checklist

I have already (please mark the applicable with an x):

  • Upgraded to the latest version of the relevant libraries
  • Checked to see if the issue has already been raised
  • Created an executable example that demonstrates the issue using either:

Software versions

  • pact library:
  • pact-ruby-standalone: 1.91.0
  • OS: Windows 11 Pro 22H2 Build 22621.1105

Expected behaviour

Pact tools installed correctly

Actual behaviour

Pact tools do not run and receive error
/pact/lib/ruby/bin/ruby: line 6: /pact/lib/ruby/bin.real/ruby: cannot execute: required file not found

Steps to reproduce

See gist

Please let me know if you need more information/none of this is relevant/I'm a moron and missing something obvious.

@YOU54F
Copy link
Member

YOU54F commented Apr 18, 2023

Thanks for the issue and gist, you need to install gcompat

top run is after adding apk add gcompat

Screenshot 2023-04-18 at 23 03 27

I came across the issue last night

FROM golang:1.20.2-alpine3.17

WORKDIR ../

ENV PACT_VERSION=1.91.0 \
    GLIBC_VERSION=2.35-r0

# Glibc for alpine. Pact has a dependancie on glibc in its ruby implementation, musl-dev from base image is not compatible
# https://github.com/pact-foundation/pact-ruby-standalone/wiki/Using-the-pact-ruby-standalone-with-Alpine-Linux-Docker
RUN apk --no-cache add gcompat bash=5.2.15-r0 \
     && wget -O /etc/apk/keys/sgerrand.rsa.pub -q https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub \
     && wget -q https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${GLIBC_VERSION}/glibc-${GLIBC_VERSION}.apk \
     && apk --no-cache --force-overwrite add glibc-${GLIBC_VERSION}.apk

# Pact binaries and related dependencies
RUN wget -q https://github.com/pact-foundation/pact-ruby-standalone/releases/download/v${PACT_VERSION}/pact-${PACT_VERSION}-linux-x86_64.tar.gz \
     && tar xzf pact-${PACT_VERSION}-linux-x86_64.tar.gz \
     && rm -rf pact-${PACT_VERSION}-linux-x86_64.tar.gz \
     && ln -s /pact/bin/* /usr/local/bin

WORKDIR $GOPATH

Further docs and advise on Alpine and Ruby gems with native deps

https://nokogiri.org/tutorials/installing_nokogiri.html#linux-musl-error-loading-shared-library

@YOU54F
Copy link
Member

YOU54F commented Apr 26, 2023

Closing, feel free to re-raise if you still have issues after trying the suggested work around

@YOU54F YOU54F closed this as completed Apr 26, 2023
@YOU54F
Copy link
Member

YOU54F commented Apr 29, 2023

For alpine arm64 flavour I needed the addition of libc6-compat

FROM arm64v8/alpine

WORKDIR ../

ENV PACT_VERSION=2.0.0

RUN apk --no-cache add gcompat libc6-compat bash
RUN wget -q https://github.com/pact-foundation/pact-ruby-standalone/releases/download/v${PACT_VERSION}/pact-${PACT_VERSION}-linux-arm64.tar.gz \
     && tar xzf pact-${PACT_VERSION}-linux-arm64.tar.gz \
     && rm -rf pact-${PACT_VERSION}-linux-arm64.tar.gz \
     && ln -s /pact/bin/* /usr/local/bin

ENTRYPOINT ["pact-mock-service"]

For your x86_64 variant, it seems you can do the same, use gcompat and libc6comapt or glibc as shown above

FROM golang:1.20.2-alpine3.17

WORKDIR ../

ENV PACT_VERSION=2.0.0
RUN apk --no-cache add gcompat libc6-compat bash
RUN wget -q https://github.com/pact-foundation/pact-ruby-standalone/releases/download/v${PACT_VERSION}/pact-${PACT_VERSION}-linux-x86_64.tar.gz \
     && tar xzf pact-${PACT_VERSION}-linux-x86_64.tar.gz \
     && rm -rf pact-${PACT_VERSION}-linux-x86_64.tar.gz \
     && ln -s /pact/bin/* /usr/local/bin

ENTRYPOINT ["pact-mock-service"]

@YOU54F
Copy link
Member

YOU54F commented Apr 29, 2023

For any other users finding their way here - the wiki is now updated to reflect

https://github.com/pact-foundation/pact-ruby-standalone/wiki/Using-the-pact-ruby-standalone-with-Alpine-Linux-Docker

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

No branches or pull requests

2 participants