Pact-js: Issue with binary while running inside Docker Node Alpine

Created on 24 Apr 2019  ·  10Comments  ·  Source: pact-foundation/pact-js

Hello friends!

Thank you for Pact, I like it very much. 👍

Unfortunately, I'm unable to get it to work inside Docker.
Any ideas on how I might be getting this to work?

Please help!

Software versions

  • OS: e.g. Alpine Linux v3.9
  • Consumer Pact library: e.g. Pact JS v8.2.0
  • Node Version: v8.16.0

Expected behaviour

I expect the test to fail gracefully with the following:

4 interactions, 4 failures

Failed interactions:


* A request for json data given date count > 0
* A request with an invalid date parameter given date count > 0
* A request with a missing date parameter given date count > 0
* A request for json data given date count == 0

Actual behaviour

My test crashes with:

[2019-04-23T22:00:08.256Z]  WARN: [email protected]/26 on 6ef9934a5998: Pact exited with code 127.
 FAIL  ./pact.test.js
  dummy pact verification
    ✕ should validate the expectations of Our Little Consumer (98ms)

  ● dummy pact verification › should validate the expectations of Our Little Consumer

    /bin/sh: ./standalone/linux-x64-1.64.0/bin/pact-provider-verifier: not found

      at ChildProcess.<anonymous> (node_modules/@pact-foundation/pact-node/src/verifier.ts:156:55)

Steps to reproduce

https://github.com/halfzebra/pact-docker-issue

documentation

Most helpful comment

I have added a section to our docs website on Docker, and will reference it in the README shortly: https://docs.pact.io/docker/

All 10 comments

Thanks for the quick reply!

Very helpful links, I've read through all of them and here is what I have found.

I've tried adding build dependencies but it did not help.

RUN apk add --no-cache --virtual build-dependencies build-base

Adding Alpine-specific version of glibc as suggested here did not cut it as well.

RUN  apk --no-cache add ca-certificates wget \
     && wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub \
     && wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.29-r0/glibc-2.29-r0.apk \
     && apk add glibc-2.29-r0.apk

Both tries have resulted in the original error.

Using node:stretch works and I might go with it for now.
It does not feel like an elegant solution, because I use a custom image based on node:alpine to run my apps 😕

I think it just needs bash to run:

FROM node:8-alpine

RUN apk add --no-cache --virtual build-dependencies build-base

RUN  apk --no-cache add ca-certificates wget bash \
  && wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub \
  && wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.29-r0/glibc-2.29-r0.apk \
  && apk add glibc-2.29-r0.apk

WORKDIR /app

COPY package*.json /app/

RUN npm install

COPY . /app/

RUN npm test

Your test fails, but for the obvious reasons. Let me know how you go. If it works, I might just create a base image for use and update docs.

Adding bash worked for me, thank you for your help! 🎉

Please let me know if I could help with the docs, otherwise, this issue could be closed.

That's great news. I'll mark as an enhancement and will update the docs / example when I get some time. Thanks for the report and repro 👍

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Bumping so this doesn’t get closed unnecessarily. Should we remove stalebot?

Also, I will check the docs tomorrow and close this off afterwards (if you haven’t already)

I think stalebot is doing its job! Silly old Matt forgot to tag this with "Documentation" and also hasn't updated the docs.

In terms of getting this done, i'm thinking maybe the Wiki is the place for this (or at least, not the README). The README is really growing a bit too large/overwhelming, and I feel this is proverbial straw that justifies the move.

Ideas?

I have added a section to our docs website on Docker, and will reference it in the README shortly: https://docs.pact.io/docker/

Was this page helpful?
0 / 5 - 0 ratings