Skip to content

Commit d105234

Browse files
committed
chore(deps): update app deps + native verifier
1 parent cf1e78d commit d105234

File tree

4 files changed

+66
-9
lines changed

4 files changed

+66
-9
lines changed

Dockerfile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
FROM python:3.11
2+
3+
WORKDIR /code
4+
5+
COPY ./requirements.txt /code/requirements.txt
6+
7+
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
8+
9+
COPY ./app /code/app
10+
11+
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]

Makefile

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ fake_ci_webhook:
4444
test: .env
4545
docker-compose up --abort-on-container-exit --exit-code-from pact_verifier
4646
docker-compose logs pact_verifier
47+
test_native: .env
48+
docker-compose up --abort-on-container-exit --exit-code-from pact_verifier_native
49+
docker-compose logs pact_verifier_native
4750

4851
## =====================
4952
## Deploy tasks
@@ -108,6 +111,31 @@ test_pact_changed_webhook:
108111
## ======================
109112
## Misc
110113
## ======================
111-
114+
PROJECT := example-provider-python
115+
PYTHON_MAJOR_VERSION := 3.11
116+
sgr0 := $(shell tput sgr0)
117+
red := $(shell tput setaf 1)
118+
green := $(shell tput setaf 2)
112119
.env:
113120
touch .env
121+
122+
123+
venv:
124+
@if [ -d "./.venv" ]; then echo "$(red).venv already exists, not continuing!$(sgr0)"; exit 1; fi
125+
@type pyenv >/dev/null 2>&1 || (echo "$(red)pyenv not found$(sgr0)"; exit 1)
126+
127+
@echo "\n$(green)Try to find the most recent minor version of the major version specified$(sgr0)"
128+
$(eval PYENV_VERSION=$(shell pyenv install -l | grep "\s\s$(PYTHON_MAJOR_VERSION)\.*" | tail -1 | xargs))
129+
@echo "$(PYTHON_MAJOR_VERSION) -> $(PYENV_VERSION)"
130+
131+
@echo "\n$(green)Install the Python pyenv version if not already available$(sgr0)"
132+
pyenv install $(PYENV_VERSION) -s
133+
134+
@echo "\n$(green)Make a .venv dir$(sgr0)"
135+
~/.pyenv/versions/${PYENV_VERSION}/bin/python3 -m venv ${CURDIR}/.venv
136+
137+
@echo "\n$(green)Make it 'available' to pyenv$(sgr0)"
138+
ln -sf ${CURDIR}/.venv ~/.pyenv/versions/${PROJECT}
139+
140+
@echo "\n$(green)Use it! (populate .python-version)$(sgr0)"
141+
pyenv local ${PROJECT}

docker-compose.yml

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
version: "3"
2-
31
services:
42
api:
5-
image: tiangolo/uvicorn-gunicorn-fastapi:python3.7
3+
build:
4+
context: .
65
volumes:
76
- ./app:/app
87
expose:
@@ -28,6 +27,25 @@ services:
2827
${PACT_URL}
2928
--provider-base-url http://api:8000
3029
--provider pactflow-example-provider-python
31-
--provider-app-version ${GIT_COMMIT}
32-
--provider-version-tag ${GIT_BRANCH}
33-
--wait 10
30+
--wait 10
31+
32+
pact_verifier_native:
33+
image: pactfoundation/pact-ref-verifier:latest
34+
depends_on:
35+
- api
36+
environment:
37+
- PACT_BROKER_BASE_URL
38+
- PACT_BROKER_TOKEN
39+
- PACT_BROKER_USERNAME
40+
- PACT_BROKER_PASSWORD
41+
- PACT_BROKER_PUBLISH_VERIFICATION_RESULTS
42+
- PACT_WEBHOOK_CALLBACK_URL=${PACT_URL}
43+
- GIT_COMMIT
44+
- GIT_BRANCH
45+
command: >
46+
--hostname api
47+
--port 8000
48+
--provider-name pactflow-example-provider-python
49+
--loglevel info
50+
--provider-version $GIT_COMMIT
51+
--provider-branch $GIT_BRANCH

requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
fastapi==0.61.1
2-
uvicorn==0.11.8
1+
fastapi==0.115.5
2+
uvicorn==0.32.0

0 commit comments

Comments
 (0)