Skip to content

Commit f3315a1

Browse files
committed
Added 38 and created build helper script
1 parent e7743de commit f3315a1

File tree

3 files changed

+40
-5
lines changed

3 files changed

+40
-5
lines changed

docker/README.md

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,37 @@
11
# Introduction
2+
23
This is for contributors who want to make changes and test for all different versions of python currently supported. If you don't want to set up and install all the different python versions locally (and there are some difficulties with that) you can just run them in docker using containers.
34

45
# Setup
6+
57
To build a container say for python 3.6 change to the root directory of the project and run
68

79
```bash
8-
docker build -t pact:python36 -f docker/py36.Dockerfile .
10+
docker build -t pactfoundation:python36 -f docker/py36.Dockerfile .
911
```
1012

1113
And then to run you will need:
1214

1315
```bash
14-
docker run -it -v `pwd`:/home pact:python36
16+
docker run -it -v `pwd`:/home pactfoundation:python36
1517
```
1618

1719
If you need to debug you can change the command to:
1820

1921
```bash
20-
docker run -it -v `pwd`:/home pact:python36 sh
22+
docker run -it -v `pwd`:/home pactfoundation:python36 sh
2123
```
2224

2325
This will open a container with a prompt. From the /home location in the container you can run
24-
```
26+
27+
```bash
2528
tox -e py36
2629
```
2730

28-
In all the above if you need to run a different version change py36/python36 where appropriate.
31+
In all the above if you need to run a different version change py36/python36 where appropriate. Or you can run the convenience script to build:
32+
33+
```bash
34+
docker/build.sh 38
35+
```
36+
37+
where 38 is the python environment version (3.8 in this case)

docker/build.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/sh
2+
set -eo pipefail
3+
4+
if [ $# -ne 1 ]; then
5+
echo "$0: usage: build.sh 27|36|37|38"
6+
exit 1
7+
fi
8+
DOCKER_ENV=$1
9+
echo "Building env ${DOCKER_ENV}"
10+
11+
DOCKER_IMAGE="pactfoundation:python${DOCKER_ENV}"
12+
DOCKER_FILE="docker/py${DOCKER_ENV}.Dockerfile"
13+
14+
docker build -t $DOCKER_IMAGE -f $DOCKER_FILE .

docker/py38.Dockerfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
FROM python:3.8.2-alpine3.11
2+
3+
WORKDIR /home
4+
5+
COPY requirements_dev.txt .
6+
7+
RUN apk add gcc py-pip python-dev libffi-dev openssl-dev gcc libc-dev make
8+
9+
RUN python -m pip install psutil subprocess32
10+
RUN pip install -r requirements_dev.txt
11+
12+
CMD tox -e py38

0 commit comments

Comments
 (0)