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

feat: add docker compose example for pact consumer #139

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
ARG NODE_VERSION=20.11

FROM node:${NODE_VERSION}

WORKDIR /test

COPY package.json package.json
COPY package-lock.json package-lock.json
COPY .env .env
COPY Makefile Makefile
RUN npm install

COPY src src
# Allow github actions to write to this directory
RUN mkdir pacts
RUN chmod 777 pacts

ENV HOME /home/node
USER node


CMD ["make", "test"]
31 changes: 31 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
version: '3.6'
services:
example-consumer:
build:
context: ./
environment:
REACT_APP_API_BASE_URL: http://localhost:8080
volumes:
- pacts_data:/test/pacts
# command: tail -f /dev/null
command: make test
platform: linux/amd64

pact-broker-cli:
image: pactfoundation/pact-cli:latest-multi
platform: linux/amd64
depends_on:
- example-consumer
environment:
PACT_BROKER_BASE_URL: ${PACT_BROKER_BASE_URL}
PACT_BROKER_TOKEN: ${PACT_BROKER_TOKEN}
PACT_CONSUMER_BRANCH: ${PACT_CONSUMER_BRANCH}
PACT_CONSUMER_APP_VERSION: ${PACT_CONSUMER_APP_VERSION}
volumes:
- pacts_data:/pact/pacts
# command: tail -f /dev/null
command: |
pact-broker publish pacts --branch=$PACT_CONSUMER_BRANCH --consumer-app-version=$PACT_CONSUMER_APP_VERSION

volumes:
pacts_data: