feat: ✨ Created a mini nodeJS server with NewMan for testing without PostMan GUI.
This will mimic a run in a CD/CI environment or docker container.
This commit is contained in:
184
node_modules/newman/docker/README.md
generated
vendored
Normal file
184
node_modules/newman/docker/README.md
generated
vendored
Normal file
@@ -0,0 +1,184 @@
|
||||
<img src="https://s3.amazonaws.com/web-artefacts/cartoon-whale-8.gif+(400%C3%97225).png">
|
||||
|
||||
# newman-docker
|
||||
|
||||
This repository contains docker images for Newman.
|
||||
|
||||
<a href="https://github.com/postmanlabs/newman" target="_blank">Newman</a> is a command-line collection runner for
|
||||
<a href="https://postman.com" target="_blank">Postman</a>. It allows you to effortlessly run and test a
|
||||
<a href="https://learning.postman.com/docs/sending-requests/intro-to-collections" target="_blank">Postman Collections<a/> directly from the
|
||||
command-line. It is built with extensibility in mind so that you can easily integrate it with your continuous
|
||||
integration servers and build systems.
|
||||
|
||||
**New to Docker?** Docker allows you to package an application with all of its dependencies into a standardised unit for
|
||||
software development. Visit
|
||||
<a href="https://www.docker.com/whatisdocker" target="_blank">https://www.docker.com/whatisdocker</a> to read more about
|
||||
how docker can drastically simplify development and deployment.
|
||||
|
||||
## There are four available Docker images for Newman
|
||||
### postman/newman:alpine (lightweight):
|
||||
* <a href="https://hub.docker.com/r/postman/newman/">DockerHub</a>
|
||||
* <a href="https://github.com/postmanlabs/newman/tree/develop/docker/images/alpine">Documentation</a>
|
||||
|
||||
### postman/newman:ubuntu:
|
||||
* <a href="https://hub.docker.com/r/postman/newman/">DockerHub</a>
|
||||
* <a href="https://github.com/postmanlabs/newman/tree/develop/docker/images/ubuntu">Documentation</a>
|
||||
|
||||
### postman/newman_alpine33 (lightweight, deprecated):
|
||||
* <a href="https://hub.docker.com/r/postman/newman_alpine33/">DockerHub</a>
|
||||
* <a href="https://github.com/postmanlabs/newman/tree/develop/docker/images/alpine33">Documentation</a>
|
||||
|
||||
### postman/newman_ubuntu1404 (deprecated):
|
||||
* <a href="https://hub.docker.com/r/postman/newman_ubuntu1404/">DockerHub</a>
|
||||
* <a href="https://github.com/postmanlabs/newman/tree/develop/docker/images/ubuntu1404">Documentation</a>
|
||||
|
||||
### Note:
|
||||
The Docker images postman/newman_alpine33 and postman/newman_ubuntu1404 for Newman are deprecated. It is advised to use [postman/newman](https://hub.docker.com/r/postman/newman/) instead.
|
||||
|
||||
## Using the docker image
|
||||
|
||||
The docker image for Newman is available for download from our docker hub. You must have Docker installed in your
|
||||
system. Docker has extensive <a href="https://docs.docker.com/installation/" target="_blank">installation guideline for
|
||||
popular operating systems</a>. Choose your operating system and follow the instructions.
|
||||
|
||||
> Ensure you that you have docker installed and running in your system before proceeding with next steps. A quick test
|
||||
> to see if docker is installed correctly is to execute the command `docker run hello-world` and it should run without
|
||||
> errors.
|
||||
|
||||
**Step 1:**
|
||||
|
||||
Pull the <a href="https://registry.hub.docker.com/u/postman/newman:ubuntu/" target="_blank">newman docker
|
||||
image</a> from docker hub:
|
||||
|
||||
```terminal
|
||||
docker pull postman/newman:ubuntu
|
||||
```
|
||||
|
||||
**Step 2:**
|
||||
|
||||
Run newman commands on the image:
|
||||
|
||||
```terminal
|
||||
docker run -t postman/newman:ubuntu run https://www.getpostman.com/collections/8a0c9bc08f062d12dcda
|
||||
```
|
||||
|
||||
### Build the docker image from this repository
|
||||
|
||||
|
||||
**Step 1:**
|
||||
|
||||
Clone this repository:
|
||||
|
||||
```terminal
|
||||
git clone https://github.com/postmanlabs/newman.git
|
||||
```
|
||||
|
||||
**Step 2:**
|
||||
|
||||
Build the image:
|
||||
|
||||
```terminal
|
||||
docker build -t postman/newman:ubuntu --build-arg NEWMAN_VERSION="full semver version" .;
|
||||
```
|
||||
|
||||
**Step 3:**
|
||||
|
||||
Run a collection using the newman image:
|
||||
|
||||
```terminal
|
||||
docker run -t postman/newman:ubuntu run https://www.getpostman.com/collections/8a0c9bc08f062d12dcda
|
||||
```
|
||||
|
||||
|
||||
## Running local collection files
|
||||
|
||||
This docker image is designed to pick files from the `/etc/newman` directory within the image. You may mount the
|
||||
directory of your collection files into that location and provide the file references in standard newman parameters.
|
||||
|
||||
|
||||
```terminal
|
||||
# Mount host collections folder ~/collections, onto /etc/newman on the docker image, so that newman
|
||||
# has access to collections
|
||||
docker run -v ~/collections:/etc/newman -t postman/newman:ubuntu run "HTTPBinNewmanTestNoEnv.json.postman_collection"
|
||||
```
|
||||
|
||||
You are not required to mount a volume if you do not need to save newman report to the host, and your collection is
|
||||
available online, unless your collection requires an environment(as environments cannot be passed as URLs).
|
||||
|
||||
To know more about mounting volumes, visit
|
||||
<a href="https://docs.docker.com/userguide/dockervolumes/" target="_blank">docker documentation on shared data volumes</a>.
|
||||
|
||||
|
||||
## Examples
|
||||
|
||||
Run a local collection, pass an environment to it, and save the JSON report on the host.
|
||||
|
||||
```terminal
|
||||
docker run -v ~/collections:/etc/newman -t postman/newman:ubuntu \
|
||||
run "HTTPBinNewmanTest.json.postman_collection" \
|
||||
--environment="HTTPBinNewmanTestEnv.json.postman_environment" \
|
||||
--reporters="json,cli" --reporter-json-export="newman-results.json"
|
||||
```
|
||||
|
||||
<br />Run a remote collection, pass it a local environment, and save JUnit XML test report on the host
|
||||
|
||||
```terminal
|
||||
docker run -v ~/collections:/etc/newman -t postman/newman:ubuntu \
|
||||
run https://www.getpostman.com/collections/8a0c9bc08f062d12dcda \
|
||||
--environment="HTTPBinNewmanTestEnv.json.postman_environment" \
|
||||
--reporters="junit,cli" --reporter-junit-export="newman-report.xml"
|
||||
```
|
||||
|
||||
<br />Use a script to run a collection and do something, for example deploy the build, if all the tests pass
|
||||
|
||||
```bash
|
||||
#/bin/bash
|
||||
|
||||
# stop on first error
|
||||
set -e;
|
||||
|
||||
function onExit {
|
||||
if [ "$?" != "0" ]; then
|
||||
echo "Tests failed";
|
||||
# build failed, don't deploy
|
||||
exit 1;
|
||||
else
|
||||
echo "Tests passed";
|
||||
# deploy build
|
||||
fi
|
||||
}
|
||||
|
||||
# call onExit when the script exits
|
||||
trap onExit EXIT;
|
||||
|
||||
docker run --entrypoint -t postman/newman:ubuntu run https://www.getpostman.com/collections/8a0c9bc08f062d12dcda --suppress-exit-code;
|
||||
```
|
||||
|
||||
## Using Newman Docker images with custom reporters
|
||||
Newman Docker images can also be used with custom Newman reporters, as follows:
|
||||
```console
|
||||
docker run -v "<collection-directory>:/etc/newman" --entrypoint /bin/<bash-or-sh> <image:tag> -c "npm i -g newman-reporter-<reporter-name>; newman run sample-collection.json -r <reporter-name>"
|
||||
```
|
||||
|
||||
In the above example,
|
||||
* `<collection-directory>` is the source directory for collections. This directory will also be used to write Newman reports.
|
||||
* `<image>` is a combination of the image name (and optional tag). For instance, `postman/newman:ubuntu` or `postman/newman:alpine`
|
||||
* `<reporter-name>` is the reporter that has to be installed and loaded for the `newman run ...`
|
||||
|
||||
### Alpine
|
||||
Note that the entrypoint here is `/bin/sh`, and **not** `/bin/bash`
|
||||
```console
|
||||
docker run -v "~/collections:/etc/newman" --entrypoint /bin/sh postman/newman:alpine -c "npm i -g newman-reporter-html; newman run sample-collection.json -r html"
|
||||
```
|
||||
|
||||
### Ubuntu
|
||||
```console
|
||||
docker run -v "~/collections:/etc/newman" --entrypoint /bin/bash postman/newman:ubuntu -c "npm i -g newman-reporter-html; newman run sample-collection.json -r html"
|
||||
```
|
||||
|
||||
## Node version
|
||||
All official Newman Docker images will be shipped with the current Node LTS (Long Term Support) version. To learn more
|
||||
about the Node release schedule, see https://github.com/nodejs/Release#release-schedule. More details about individual
|
||||
Docker images can be found in their individual READMEs in this folder.
|
||||
|
||||
[](https://postman.com)
|
33
node_modules/newman/docker/images/alpine/Dockerfile
generated
vendored
Normal file
33
node_modules/newman/docker/images/alpine/Dockerfile
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
FROM node:10-alpine
|
||||
LABEL maintainer="Postman Labs <help@postman.com>"
|
||||
|
||||
ARG NEWMAN_VERSION
|
||||
|
||||
# Set environment variables
|
||||
ENV LC_ALL="en_US.UTF-8" LANG="en_US.UTF-8" LANGUAGE="en_US.UTF-8" ALPINE_NODE_REPO="oznu/alpine-node"
|
||||
|
||||
# Bail out early if NODE_VERSION is not provided
|
||||
RUN if [ ! $(echo $NEWMAN_VERSION | grep -oE "^[0-9]+\.[0-9]+\.[0-9]+$") ]; then \
|
||||
echo "\033[0;31mA valid semver Newman version is required in the NEWMAN_VERSION build-arg\033[0m"; \
|
||||
exit 1; \
|
||||
fi && \
|
||||
# Install Newman globally
|
||||
npm install --global newman@${NEWMAN_VERSION};
|
||||
|
||||
# Set workdir to /etc/newman
|
||||
# When running the image, mount the directory containing your collection to this location
|
||||
#
|
||||
# docker run -v <path to collections directory>:/etc/newman ...
|
||||
#
|
||||
# In case you mount your collections directory to a different location, you will need to give absolute paths to any
|
||||
# collection, environment files you want to pass to newman, and if you want newman reports to be saved to your disk.
|
||||
# Or you can change the workdir by using the -w or --workdir flag
|
||||
WORKDIR /etc/newman
|
||||
|
||||
# Set newman as the default container command
|
||||
# Now you can run the container via
|
||||
#
|
||||
# docker run -v /home/collections:/etc/newman -t postman/newman_alpine run YourCollection.json.postman_collection \
|
||||
# -e YourEnvironment.postman_environment \
|
||||
# -H newman_report.html
|
||||
ENTRYPOINT ["newman"]
|
38
node_modules/newman/docker/images/alpine/README.md
generated
vendored
Normal file
38
node_modules/newman/docker/images/alpine/README.md
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
# newman:alpine
|
||||
|
||||
This image runs newman on node v10 on Alpine
|
||||
|
||||
Build the image:
|
||||
|
||||
```terminal
|
||||
docker build -t postman/newman:alpine --build-arg NEWMAN_VERSION="full semver version" .
|
||||
```
|
||||
|
||||
Or get it from [Docker Hub](https://registry.hub.docker.com/u/postman/newman/):
|
||||
|
||||
```terminal
|
||||
docker pull postman/newman:alpine
|
||||
```
|
||||
|
||||
Then run it:
|
||||
|
||||
```terminal
|
||||
docker --volume="/home/postman/collections:/etc/newman" -t postman/newman:alpine run JSONBlobCoreAPI.json.postman_collection -r json --reporter-json-export newman-report.json
|
||||
```
|
||||
For newman-docker to be able to use collections and environment files saved on the host machine, and to save reports generated by newman, a directory containing the collection and environment needs to be mounted on to the docker instance on run time, preferably at `/etc/newman`, which is the default working directory. If you mount to a different location, then:
|
||||
- You can pass the full path to your collection and environment files to newman. For instance, if you mount to `/etc/newman`,
|
||||
|
||||
```terminal
|
||||
docker --volume="/home/postman/collection:/etc/newman" -t postman/newman:alpine run JSONBlobCoreAPI.json.postman_collection" -r json --reporter-json-export newman-report.json
|
||||
```
|
||||
- You can change the working directory while running the image to the location you mounted to, using the `-w` or `--workdir` flag.
|
||||
|
||||
```terminal
|
||||
docker run --volume="/home/postman/collections:/etc/newman" -t postman/newman:alpine run JSONBlobCoreAPI.json.postman_collection -r json --reporter-json-export newman-report.json
|
||||
```
|
||||
|
||||
In case you don't need to save newman's report to the host, and your collection is available online and does not require any environment, then you can forgo mounting your collections directory and directly pass the collection URL to newman:
|
||||
|
||||
```terminal
|
||||
docker run -t postman/newman:alpine run https://www.getpostman.com/collections/8a0c9bc08f062d12dcda
|
||||
```
|
48
node_modules/newman/docker/images/alpine33/Dockerfile
generated
vendored
Normal file
48
node_modules/newman/docker/images/alpine33/Dockerfile
generated
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
FROM alpine:3.3
|
||||
LABEL maintainer="Postman Labs <help@postman.com>"
|
||||
|
||||
ARG NODE_VERSION=10
|
||||
ARG NEWMAN_VERSION
|
||||
|
||||
# Set environment variables
|
||||
ENV LC_ALL="en_US.UTF-8" LANG="en_US.UTF-8" LANGUAGE="en_US.UTF-8" ALPINE_NODE_REPO="oznu/alpine-node"
|
||||
|
||||
# Bail out early if NODE_VERSION is not provided
|
||||
RUN if [ ! $(echo $NEWMAN_VERSION | grep -oE "^[0-9]+\.[0-9]+\.[0-9]+$") ]; then \
|
||||
echo "\033[0;31mA valid semver Newman version is required in the NEWMAN_VERSION build-arg\033[0m"; \
|
||||
exit 1; \
|
||||
fi && \
|
||||
# Add the latest Alpine Linux package to the repositories list
|
||||
echo -e "https://nl.alpinelinux.org/alpine/v3.3/main/\nhttps://nl.alpinelinux.org/alpine/v3.3/community/" > /etc/apk/repositories && \
|
||||
# Update existing packages and install Node dependencies
|
||||
apk add --update --no-cache libgcc libstdc++ jq curl && \
|
||||
# Determine the complete Semver Node version for the provided Node major version in $NODE_VERSION
|
||||
FULL_NODE_VERSION=$(curl --silent "https://api.github.com/repos/${ALPINE_NODE_REPO}/releases" | jq -r '.[].tag_name' | grep -oE "^${NODE_VERSION}\.\d+\.\d+$" | sort -r -t. -k 1,1nr -k 2,2nr -k 3,3nr | head -n1) && \
|
||||
# Download the appropriate Node binary for Alpine Linux
|
||||
curl --silent -L "https://github.com/${ALPINE_NODE_REPO}/releases/download/${FULL_NODE_VERSION}/node-v${FULL_NODE_VERSION}-linux-x86_64-alpine.tar.gz" > /etc/alpine-node-${NODE_VERSION}.tar.gz && \
|
||||
# Extract and install Node from the binary downloaded in the previous step
|
||||
tar -xzf /etc/alpine-node-${NODE_VERSION}.tar.gz -C /usr --no-same-owner && \
|
||||
# Install Newman globally
|
||||
npm install --global newman@${NEWMAN_VERSION} && \
|
||||
# Prune redundant packages
|
||||
apk del jq curl && \
|
||||
# Clear Alpine Node binary
|
||||
rm /etc/alpine-node-${NODE_VERSION}.tar.gz;
|
||||
|
||||
# Set workdir to /etc/newman
|
||||
# When running the image, mount the directory containing your collection to this location
|
||||
#
|
||||
# docker run -v <path to collections directory>:/etc/newman ...
|
||||
#
|
||||
# In case you mount your collections directory to a different location, you will need to give absolute paths to any
|
||||
# collection, environment files you want to pass to newman, and if you want newman reports to be saved to your disk.
|
||||
# Or you can change the workdir by using the -w or --workdir flag
|
||||
WORKDIR /etc/newman
|
||||
|
||||
# Set newman as the default container command
|
||||
# Now you can run the container via
|
||||
#
|
||||
# docker run -v /home/collections:/etc/newman -t postman/newman_alpine33 run YourCollection.json.postman_collection \
|
||||
# -e YourEnvironment.postman_environment \
|
||||
# -H newman_report.html
|
||||
ENTRYPOINT ["newman"]
|
39
node_modules/newman/docker/images/alpine33/README.md
generated
vendored
Normal file
39
node_modules/newman/docker/images/alpine33/README.md
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
# newman_alpine33 (deprecated)
|
||||
## Use postman/newman:alpine instead. See https://hub.docker.com/r/postman/newman/ for more available tags
|
||||
|
||||
This image runs newman on node v8 on Alpine 3.3
|
||||
|
||||
Build the image:
|
||||
|
||||
```terminal
|
||||
docker build -t postman/newman_alpine33 --build-arg NEWMAN_VERSION="full semver version" .
|
||||
```
|
||||
|
||||
Or get it from [Docker Hub](https://registry.hub.docker.com/u/postman/newman_alpine33/):
|
||||
|
||||
```terminal
|
||||
docker pull postman/newman_alpine33
|
||||
```
|
||||
|
||||
Then run it:
|
||||
|
||||
```terminal
|
||||
docker --volume="/home/postman/collections:/etc/newman" -t postman/newman_alpine33 run JSONBlobCoreAPI.json.postman_collection -r json --reporter-json-export newman-report.json
|
||||
```
|
||||
For newman-docker to be able to use collections and environment files saved on the host machine, and to save reports generated by newman, a directory containing the collection and environment needs to be mounted on to the docker instance on run time, preferably at `/etc/newman`, which is the default working directory. If you mount to a different location, then:
|
||||
- You can pass the full path to your collection and environment files to newman. For instance, if you mount to `/etc/newman`,
|
||||
|
||||
```terminal
|
||||
docker --volume="/home/postman/collection:/etc/newman" -t postman/newman_alpine33 run JSONBlobCoreAPI.json.postman_collection" -r json --reporter-json-export newman-report.json
|
||||
```
|
||||
- You can change the working directory while running the image to the location you mounted to, using the `-w` or `--workdir` flag.
|
||||
|
||||
```terminal
|
||||
docker run --volume="/home/postman/collections:/etc/newman" -t postman/newman_alpine33 run JSONBlobCoreAPI.json.postman_collection -r json --reporter-json-export newman-report.json
|
||||
```
|
||||
|
||||
In case you don't need to save newman's report to the host, and your collection is available online and does not require any environment, then you can forgo mounting your collections directory and directly pass the collection URL to newman:
|
||||
|
||||
```terminal
|
||||
docker run -t postman/newman_alpine33 run https://www.getpostman.com/collections/8a0c9bc08f062d12dcda
|
||||
```
|
44
node_modules/newman/docker/images/ubuntu/Dockerfile
generated
vendored
Normal file
44
node_modules/newman/docker/images/ubuntu/Dockerfile
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
FROM ubuntu:18.04
|
||||
LABEL maintainer="Postman Labs <help@postman.com>"
|
||||
|
||||
ARG NODE_VERSION=10
|
||||
ARG NEWMAN_VERSION
|
||||
|
||||
# Bail out early if NODE_VERSION is not provided
|
||||
RUN if [ ! $(echo $NEWMAN_VERSION | grep -oE "^[0-9]+\.[0-9]+\.[0-9]+$") ]; then \
|
||||
echo "\033[0;31mA valid semver Newman version is required in the NEWMAN_VERSION build-arg\033[0m"; \
|
||||
exit 1; \
|
||||
fi
|
||||
|
||||
# Install node
|
||||
ADD https://deb.nodesource.com/setup_$NODE_VERSION.x /opt/install_node.sh
|
||||
|
||||
RUN apt-get update -y && \
|
||||
apt-get upgrade -y && \
|
||||
apt-get install -y gnupg && \
|
||||
bash /opt/install_node.sh && \
|
||||
apt-get install -y nodejs && \
|
||||
npm install -g newman@${NEWMAN_VERSION} && \
|
||||
rm /opt/install_node.sh && \
|
||||
apt-get purge -y gnupg;
|
||||
|
||||
# Set environment variables
|
||||
ENV LC_ALL="en_US.UTF-8" LANG="en_US.UTF-8" LANGUAGE="en_US.UTF-8"
|
||||
|
||||
# Set workdir to /etc/newman
|
||||
# When running the image, mount the directory containing your collection to this location
|
||||
#
|
||||
# docker run -v <path to collections directory>:/etc/newman ...
|
||||
#
|
||||
# In case you mount your collections directory to a different location, you will need to give absolute paths to any
|
||||
# collection, environment files you want to pass to newman, and if you want newman reports to be saved to your disk.
|
||||
# Or you can change the workdir by using the -w or --workdir flag
|
||||
WORKDIR /etc/newman
|
||||
|
||||
# Set newman as the default container command
|
||||
# Now you can run the container via
|
||||
#
|
||||
# docker run -v /home/collections:/etc/newman -t postman/newman_ubuntu run YourCollection.json.postman_collection \
|
||||
# -e YourEnvironment.postman_environment \
|
||||
# -H newman_report.html
|
||||
ENTRYPOINT ["newman"]
|
38
node_modules/newman/docker/images/ubuntu/README.md
generated
vendored
Normal file
38
node_modules/newman/docker/images/ubuntu/README.md
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
# newman:ubuntu
|
||||
|
||||
This image runs newman on node v10 on Ubuntu 18.04
|
||||
|
||||
Build the image,
|
||||
|
||||
```terminal
|
||||
docker build -t postman/newman:ubuntu --build-arg NEWMAN_VERSION="full semver version" .
|
||||
```
|
||||
|
||||
Or get it from [docker hub](https://registry.hub.docker.com/u/postman/newman:ubuntu/)
|
||||
|
||||
```terminal
|
||||
docker pull postman/newman:ubuntu
|
||||
```
|
||||
|
||||
Then run it
|
||||
|
||||
```terminal
|
||||
docker --volume="/home/postman/collections:/etc/newman" -t postman/newman:ubuntu run JSONBlobCoreAPI.json.postman_collection -r json --reporter-json-export newman-report.json
|
||||
```
|
||||
For newman-docker to be able to use collections and environment files saved on the host machine, and to save reports generated by newman, a directory containing the collection and environment needs to be mounted on to the docker instance on run time, preferably at `/etc/newman`, which is the default working directory. If you mount to a different location, then
|
||||
- You can either pass the full path to your collection and environment files to newman. For instance, if you mount to `/etc/newman`,
|
||||
|
||||
```terminal
|
||||
docker --volume="/home/postman/collection:/etc/newman" -t postman/newman:ubuntu run JSONBlobCoreAPI.json.postman_collection -r json --reporter-json-export newman-report.json
|
||||
```
|
||||
- You can change the working directory while running the image to the location you mounted to, using the `-w` or `--workdir` flag.
|
||||
|
||||
```terminal
|
||||
docker run --volume="/home/postman/collections:/etc/newman" -t postman/newman:ubuntu run JSONBlobCoreAPI.json.postman_collection -r json --reporter-json-export newman-report.json
|
||||
```
|
||||
|
||||
In case you don't need to save newman's report to the host, and your collection is available online and it does not require any environment, then you can forgo mounting your collections directory, and directly pass the collection url to newman
|
||||
|
||||
```terminal
|
||||
docker run -t postman/newman:ubuntu run https://www.getpostman.com/collections/8a0c9bc08f062d12dcda
|
||||
```
|
40
node_modules/newman/docker/images/ubuntu1404/Dockerfile
generated
vendored
Normal file
40
node_modules/newman/docker/images/ubuntu1404/Dockerfile
generated
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
FROM ubuntu:14.04.2
|
||||
LABEL maintainer="Postman Labs <help@postman.com>"
|
||||
|
||||
ARG NODE_VERSION=10
|
||||
ARG NEWMAN_VERSION
|
||||
|
||||
# Bail out early if NODE_VERSION is not provided
|
||||
RUN if [ ! $(echo $NEWMAN_VERSION | grep -oE "^[0-9]+\.[0-9]+\.[0-9]+$") ]; then \
|
||||
echo "\033[0;31mA valid semver Newman version is required in the NEWMAN_VERSION build-arg\033[0m"; \
|
||||
exit 1; \
|
||||
fi
|
||||
|
||||
# Install node
|
||||
ADD https://deb.nodesource.com/setup_$NODE_VERSION.x /opt/install_node.sh
|
||||
|
||||
RUN bash /opt/install_node.sh && \
|
||||
apt-get install -y nodejs && \
|
||||
npm install -g newman@${NEWMAN_VERSION} && \
|
||||
rm /opt/install_node.sh;
|
||||
|
||||
# Set environment variables
|
||||
ENV LC_ALL="en_US.UTF-8" LANG="en_US.UTF-8" LANGUAGE="en_US.UTF-8"
|
||||
|
||||
# Set workdir to /etc/newman
|
||||
# When running the image, mount the directory containing your collection to this location
|
||||
#
|
||||
# docker run -v <path to collections directory>:/etc/newman ...
|
||||
#
|
||||
# In case you mount your collections directory to a different location, you will need to give absolute paths to any
|
||||
# collection, environment files you want to pass to newman, and if you want newman reports to be saved to your disk.
|
||||
# Or you can change the workdir by using the -w or --workdir flag
|
||||
WORKDIR /etc/newman
|
||||
|
||||
# Set newman as the default container command
|
||||
# Now you can run the container via
|
||||
#
|
||||
# docker run -v /home/collections:/etc/newman -t postman/newman_ubuntu1404 run YourCollection.json.postman_collection \
|
||||
# -e YourEnvironment.postman_environment \
|
||||
# -H newman_report.html
|
||||
ENTRYPOINT ["newman"]
|
39
node_modules/newman/docker/images/ubuntu1404/README.md
generated
vendored
Normal file
39
node_modules/newman/docker/images/ubuntu1404/README.md
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
# newman_ubuntu1404 (deprecated)
|
||||
## Use postman/newman:ubuntu instead. See https://hub.docker.com/r/postman/newman/ for more available tags
|
||||
|
||||
This image runs newman on node v10 on Ubuntu 14.04.2
|
||||
|
||||
Build the image,
|
||||
|
||||
```terminal
|
||||
docker build -t postman/newman_ubuntu1404 --build-arg NEWMAN_VERSION="full semver version" .
|
||||
```
|
||||
|
||||
Or get it from [docker hub](https://registry.hub.docker.com/u/postman/newman_ubuntu1404/)
|
||||
|
||||
```terminal
|
||||
docker pull postman/newman_ubuntu1404
|
||||
```
|
||||
|
||||
then run it
|
||||
|
||||
```terminal
|
||||
docker --volume="/home/postman/collections:/etc/newman" -t postman/newman_ubuntu1404 run JSONBlobCoreAPI.json.postman_collection -r json --reporter-json-export newman-report.json
|
||||
```
|
||||
For newman-docker to be able to use collections and environment files saved on the host machine, and to save reports generated by newman, a directory containing the collection and environment needs to be mounted on to the docker instance on run time, preferably at `/etc/newman`, which is the default working directory. If you mount to a different location, then
|
||||
- You can either pass the full path to your collection and environment files to newman. For instance, if you mount to `/etc/newman`,
|
||||
|
||||
```terminal
|
||||
docker --volume="/home/postman/collection:/etc/newman" -t postman/newman_ubuntu1404 run JSONBlobCoreAPI.json.postman_collection -r json --reporter-json-export newman-report.json
|
||||
```
|
||||
- You can change the working directory while running the image to the location you mounted to, using the `-w` or `--workdir` flag.
|
||||
|
||||
```terminal
|
||||
docker run --volume="/home/postman/collections:/etc/newman" -t postman/newman_ubuntu1404 run JSONBlobCoreAPI.json.postman_collection -r json --reporter-json-export newman-report.json
|
||||
```
|
||||
|
||||
In case you don't need to save newman's report to the host, and your collection is available online and it does not require any environment, then you can forgo mounting your collections directory, and directly pass the collection url to newman
|
||||
|
||||
```terminal
|
||||
docker run -t postman/newman_ubuntu1404 run https://www.getpostman.com/collections/8a0c9bc08f062d12dcda
|
||||
```
|
Reference in New Issue
Block a user