Skip to content

Commit b550fb9

Browse files
authored
Merge pull request #345 from pact-foundation/docs/docker_guidance
docs: update docker guidance
2 parents 6d4d9e6 + 65a9928 commit b550fb9

File tree

1 file changed

+71
-27
lines changed

1 file changed

+71
-27
lines changed

website/docs/docker.md

+71-27
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@ Often times, you'll want to use Docker to run Pact. For example, a common approa
88

99
We provide official containers to run common utilities as Docker images. All images from the `"pactfoundation"` [repository](https://hub.docker.com/u/pactfoundation) can be considered official:
1010

11-
* CLI Tools: [https://hub.docker.com/r/pactfoundation/pact-cli](https://hub.docker.com/r/pactfoundation/pact-cli) \(includes the Ruby implementation of the mock service, a language agnostic provider verifier, and the Pact Broker client tools.\)
12-
* Pact Broker: [https://hub.docker.com/r/pactfoundation/pact-broker/](https://hub.docker.com/r/pactfoundation/pact-broker/)
11+
* Mock Server: [https://hub.docker.com/r/pactfoundation/pact-ref-mock-server](https://hub.docker.com/r/pactfoundation/pact-ref-mock-server)
1312
* Stub Server: [https://hub.docker.com/r/pactfoundation/pact-stub-server](https://hub.docker.com/r/pactfoundation/pact-stub-server)
13+
* Provider Verifier: [https://hub.docker.com/r/pactfoundation/pact-ref-verifier](https://hub.docker.com/r/pactfoundation/pact-ref-verifier)
14+
* CLI Tools: [https://hub.docker.com/r/pactfoundation/pact-cli](https://hub.docker.com/r/pactfoundation/pact-cli)(Pact Broker client tool plus the Ruby implementation of the mock service & provider verifier.)
15+
* Pact Broker: [https://hub.docker.com/r/pactfoundation/pact-broker/](https://hub.docker.com/r/pactfoundation/pact-broker/)
1416

1517
## Running Pact on Docker
1618

@@ -20,10 +22,10 @@ If you want to run your Pact tests in Docker, please note the following guidance
2022

2123
#### For Pact implementations that use the [Rust shared core](roadmap/feature_support)
2224
:::info
23-
**Applicable languages**: Pact JS, Pact .NET, Pact Go, Pact C++ and Pact Swift
25+
**Applicable languages**: Pact JS, Pact .NET, Pact Go, Pact-PHP, Pact C++ and Pact Swift
2426
:::
2527

26-
Pact currently requires glibc `>= 2.29`. Most modern debian-based images will ship with a compatible version.
28+
Pact currently requires glibc `>= 2.23`. Most modern debian-based images will ship with a compatible version.
2729

2830
You can check the version of glibc installed via the `ldd` command:
2931

@@ -39,13 +41,36 @@ Written by Roland McGrath and Ulrich Drepper.
3941
If you see an error that looks like the following, taken from a JS project, it means your version of glibc is incompatible:
4042

4143
```
42-
/lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.25' not found (required by /app/node_modules/@pact-foundation/pact-core/build/Release/libpact_ffi.so)
44+
/lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.23' not found (required by /app/node_modules/@pact-foundation/pact-core/build/Release/libpact_ffi.so)
4345
```
4446

47+
For a more exhaustive list of glibc versions against distroes, see the below table
48+
49+
Distribution | glibc version
50+
-- | --
51+
Arch Linux | 2.36
52+
Alpine 3.13 | N/A
53+
CentOS 7 | 2.17
54+
CentOS Stream 8 | 2.28
55+
CentOS Stream 9 | 2.34
56+
Debian 9 (Stretch) | 2.24
57+
Debian 10 (Buster) | 2.28
58+
Debian 11 (Bullseye) | 2.31
59+
Fedora 35 | 2.34
60+
Homebrew | 2.23
61+
OpenSUSE Leap 15.3 | 2.31
62+
OpenSUSE Tumbleweed | 2.35
63+
RHEL 7 | 2.17
64+
RHEL 8 | 2.28
65+
RHEL 9 | 2.34
66+
Ubuntu 18.04 | 2.27
67+
Ubuntu 20.04 | 2.31
68+
Ubuntu 22.04 | 2.35
69+
4570

4671
#### For Pact implementations that use the [Ruby shared core](roadmap/feature_support)
4772
:::info
48-
**Applicable languages**: Pact PHP, Python
73+
**Applicable languages**: Python
4974
:::
5075

5176
Pact currently [requires](https://github.com/phusion/traveling-ruby/blob/10262231f19238c638e7a4806408cf1e57cb2dca/CHANGELOG.md#version-20210206) glibc `>= 2.17`. The minimum supported Linux version is now RHEL 7 / CentOS 7 / Debian 8 / Ubuntu 14.06 / glibc 2.17.
@@ -55,41 +80,67 @@ Pact currently [requires](https://github.com/phusion/traveling-ruby/blob/1026223
5580
Here is an example JS container that will run Pact tests within an official Node container based on Debian.
5681

5782
```shell
58-
FROM node:18
59-
60-
RUN apt-get update -y && \
61-
apt-get install -y git g++ python3 build-essential && \
62-
rm -rf /var/lib/apt/lists/*
83+
FROM node:20
6384

64-
COPY ./ /app/
6585
WORKDIR /app
86+
87+
COPY package*.json /app/
6688
RUN npm install
67-
CMD ["npm", "t"]
89+
COPY . /app/
90+
91+
RUN npm test
6892
```
6993

70-
*NOTE: we are installing some build tools here to allow native dependencies to be compiled, this is a prerequisite for many NodeJS packages, including Pact. Other languages may not require this*
7194

7295
### Alpine Linux
7396

7497
Many teams choose to run builds on Alpine Linux due to its tiny footprint, and smaller security surface area.
7598

7699
#### For Pact implementations that use the [Rust shared core](roadmap/feature_support) or
77100
:::info
78-
**Applicable languages**: Pact JS, Pact .NET, Pact Go, Pact C++ and Pact Swift
101+
**Applicable languages**: Pact JS, Pact .NET, Pact Go, Pact-PHP, Pact C++ and Pact Swift
79102
:::
80103

81-
Alpine is not supported as it requires us to build dynamically linked libraries for each specific version of Alpine and musl.
104+
- Executable builds are static, and therefore the single binary works across musl or glibc based distros (excluding ffi)
105+
- pact_ffi library comes in both static `*.a` & shared `*.so` variants for musl, depending on the consuming client libraries requirements for ffi interop
106+
107+
Support is available in the following tools for Alpine from specific versions.
108+
109+
| library | alpine support | version |
110+
| -- | -- | -- |
111+
| pact_ffi | ✅ | - `x86_64` `.a` from [0.2.4](https://github.com/pact-foundation/pact-reference/releases/tag/libpact_ffi-v0.2.4)
112+
| | | - `aarch64` `.a` from [0.4.15](https://github.com/pact-foundation/pact-reference/releases/tag/libpact_ffi-v0.4.15)|
113+
| | | - `.so` from [0.4.17](https://github.com/pact-foundation/pact-reference/releases/tag/libpact_ffi-v0.4.17) | |
114+
| pact_mock_server_cli | ✅ | - [1.0.5](https://github.com/pact-foundation/pact-reference/releases/tag/pact_mock_server_cli-v1.0.5)
115+
| pact_verifier_cli | ✅ | - [1.1.1](https://github.com/pact-foundation/pact-reference/releases/tag/pact_verifier_cli-v1.1.1)
116+
| pact-stub-server || - [0.6.0](https://github.com/pact-foundation/pact-stub-server/releases/tag/v0.6.0) |
117+
| pact-plugin-cli || - [0.1.2](https://github.com/pact-foundation/pact-plugins/releases/tag/pact-plugin-cli-v0.1.2) |
118+
| pact-protobuf-plugin || - [0.3.15](https://github.com/pactflow/pact-protobuf-plugin/releases/tag/v-0.3.15) |
119+
| pact-csv-plugin || - [0.0.6](https://github.com/pact-foundation/pact-plugins/releases/tag/csv-plugin-0.0.6) |
82120

83-
It's possible to make it work, but we make no guarantees and it's likely to [break](https://ariadne.space/2021/08/26/there-is-no-such-thing-as-a-glibc-based-alpine-image/) in subtle ways and we would instead recommend adopting Ubuntu or Debian which supports linking to glibc.
121+
#### Reference Image
122+
123+
Here is an example NodeJS container that can be used as a reference to create a working container for your example:
124+
125+
```bash
126+
FROM node:20-alpine
127+
128+
WORKDIR /app
129+
130+
COPY package*.json /app/
131+
RUN npm install
132+
COPY . /app/
133+
134+
RUN npm test
135+
```
84136

85137
#### For Pact implementations that use the [Ruby shared core](roadmap/feature_support)
86138
:::info
87-
**Applicable languages**: Pact PHP, Python
139+
**Applicable languages**: Python
88140
:::
89141

90142
You'll need to ensure the following dependencies are met:
91143

92-
* Bash \(it's not enough to have Ash\)
93144
* Standard CAs for TLS network communication
94145
* glibc (>= 2.17)
95146

@@ -100,14 +151,7 @@ _NOTE_: You do not need to install Ruby. The distribution takes care of this for
100151
Here is an example NodeJS container that can be used as a reference to create a working container for your example:
101152

102153
```bash
103-
FROM node:8-alpine
104-
105-
RUN apk add --no-cache --virtual build-dependencies build-base
106-
107-
RUN apk --no-cache add ca-certificates wget bash \
108-
&& wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub \
109-
&& wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.29-r0/glibc-2.29-r0.apk \
110-
&& apk add glibc-2.29-r0.apk
154+
FROM node:20-alpine
111155

112156
WORKDIR /app
113157

0 commit comments

Comments
 (0)