diff --git a/Dockerfile.alpine b/Dockerfile.alpine new file mode 100644 index 000000000..ba155553a --- /dev/null +++ b/Dockerfile.alpine @@ -0,0 +1,9 @@ +ARG NODE_VERSION=current +FROM node:${NODE_VERSION}-alpine + +RUN apk add bash curl git file libc6-compat gcompat jq +# libc6-compat gcompat required for @pact-foundation/pact-cli ruby runtime +# all other dependencies just used for @pact-foundation/pact testing +# so you don't need to use those in your own projects + +ENTRYPOINT [ "bash", "-c", "scripts/ci/build-and-test.sh" ] \ No newline at end of file diff --git a/Dockerfile.debian b/Dockerfile.debian new file mode 100644 index 000000000..23d043ca8 --- /dev/null +++ b/Dockerfile.debian @@ -0,0 +1,8 @@ +ARG NODE_VERSION=latest +FROM node:${NODE_VERSION}-slim + +RUN apt-get -y update && apt-get -y install curl git jq +# dependencies just used for @pact-foundation/pact testing +# so you don't need to use those in your own projects + +ENTRYPOINT [ "bash", "-c", "scripts/ci/build-and-test.sh" ] \ No newline at end of file diff --git a/package.json b/package.json index b9b5a96ec..8da964a19 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,13 @@ "predist": "npm run clean && npm run format:check && npm run lint", "release": "commit-and-tag-version", "test": "nyc --check-coverage --reporter=html --reporter=text-summary mocha -t 120000", - "pretest": "bash scripts/install-plugins.sh" + "pretest": "bash scripts/install-plugins.sh", + "docker:alpine:build": "docker build --build-arg NODE_VERSION=${NODE_VERSION:-current} -f Dockerfile.alpine -t pact-js:alpine .", + "docker:debian:build": "docker build --build-arg NODE_VERSION=${NODE_VERSION:-current} -f Dockerfile.debian -t pact-js:debian .", + "docker:alpine:run": "docker run -e LOG_LEVEL=${LOG_LEVEL:-info} -e GIT_REF=${GIT_REF:-test} -e GITHUB_ACTIONS=${GITHUB_ACTIONS:-false} -e SKIP_EXAMPLES=${SKIP_EXAMPLES:-''} -w /home -v $(pwd):/home --rm pact-js:alpine", + "docker:debian:run": "docker run -e LOG_LEVEL=${LOG_LEVEL:-info} -e GIT_REF=${GIT_REF:-test} -e GITHUB_ACTIONS=${GITHUB_ACTIONS:-false} -e SKIP_EXAMPLES=${SKIP_EXAMPLES:-''} -w /home -v $(pwd):/home --rm pact-js:debian", + "docker:alpine:attach": "docker run -w /home -v $(pwd):/home --entrypoint /bin/bash --rm -it pact-js:alpine", + "docker:debian:attach": "docker run -w /home -v $(pwd):/home --entrypoint /bin/bash --rm -it pact-js:debian" }, "repository": { "type": "git",