Skip to content

Commit

Permalink
Update postman/newman:ubuntu docker image
Browse files Browse the repository at this point in the history
  • Loading branch information
codenirvana committed Sep 14, 2023
1 parent 2187038 commit fb2a995
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 47 deletions.
2 changes: 1 addition & 1 deletion docker/images/alpine/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# newman:alpine

This image runs newman on node v10 on Alpine
This image runs newman on node v16 on Alpine

Build the image:

Expand Down
35 changes: 21 additions & 14 deletions docker/images/ubuntu/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,26 +1,33 @@
FROM ubuntu:18.04
FROM ubuntu:22.04
LABEL maintainer="Postman Labs <help@postman.com>"

ARG NODE_VERSION=10
ARG NODE_MAJOR=16
ARG NEWMAN_VERSION

# Bail out early if NODE_VERSION is not provided
# Bail out early if NEWMAN_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;
RUN \
# Download and import the Nodesource GPG key
apt-get update; \
apt-get install -y ca-certificates curl gnupg; \
mkdir -p /etc/apt/keyrings; \
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key \
| gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg; \

# Create deb repository
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" \
| tee /etc/apt/sources.list.d/nodesource.list; \

# Run Update and Install
apt-get update; \
apt-get install nodejs -y; \

# Install Newman globally
npm install --global newman@${NEWMAN_VERSION};

# Set environment variables
ENV LC_ALL="en_US.UTF-8" LANG="en_US.UTF-8" LANGUAGE="en_US.UTF-8"
Expand Down
2 changes: 1 addition & 1 deletion docker/images/ubuntu/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# newman:ubuntu

This image runs newman on node v10 on Ubuntu 18.04
This image runs newman on node v16 on Ubuntu 22.04

Build the image,

Expand Down
52 changes: 21 additions & 31 deletions npm/postpublish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,40 +37,30 @@ function build_docker_image {

# Tag
if [[ ${GIT_BRANCH} == "master" ]]; then
if [[ ${TAG} == "ubuntu1404" || ${TAG} == "alpine33" ]]; then
docker tag ${DOCKER_REPO}:${VERSION}-${TAG} ${DOCKER_REPO}_${TAG}:latest;
docker push ${DOCKER_REPO}_${TAG}:latest;
else
docker tag ${DOCKER_REPO}:${VERSION}-${TAG} ${DOCKER_REPO}:${TAG};
docker push ${DOCKER_REPO}:${TAG};

if [[ ${TAG} == ${LATEST} ]]; then
docker tag ${DOCKER_REPO}:${VERSION}-${TAG} ${DOCKER_REPO}:latest;
docker tag ${DOCKER_REPO}:${VERSION}-${TAG} ${DOCKER_REPO}:${VERSION};
docker tag ${DOCKER_REPO}:${VERSION}-${TAG} ${DOCKER_REPO}:${MINOR};
docker tag ${DOCKER_REPO}:${VERSION}-${TAG} ${DOCKER_REPO}:${MAJOR};

docker push ${DOCKER_REPO}:latest;
docker push ${DOCKER_REPO}:${VERSION};
docker push ${DOCKER_REPO}:${MINOR};
docker push ${DOCKER_REPO}:${MAJOR};
fi
docker tag ${DOCKER_REPO}:${VERSION}-${TAG} ${DOCKER_REPO}:${TAG};
docker push ${DOCKER_REPO}:${TAG};

if [[ ${TAG} == ${LATEST} ]]; then
docker tag ${DOCKER_REPO}:${VERSION}-${TAG} ${DOCKER_REPO}:latest;
docker tag ${DOCKER_REPO}:${VERSION}-${TAG} ${DOCKER_REPO}:${VERSION};
docker tag ${DOCKER_REPO}:${VERSION}-${TAG} ${DOCKER_REPO}:${MINOR};
docker tag ${DOCKER_REPO}:${VERSION}-${TAG} ${DOCKER_REPO}:${MAJOR};

docker push ${DOCKER_REPO}:latest;
docker push ${DOCKER_REPO}:${VERSION};
docker push ${DOCKER_REPO}:${MINOR};
docker push ${DOCKER_REPO}:${MAJOR};
fi
fi

if [[ ${TAG} == "ubuntu1404" || ${TAG} == "alpine33" ]]; then
docker tag ${DOCKER_REPO}:${VERSION}-${TAG} ${DOCKER_REPO}_${TAG}:${VERSION};
docker push ${DOCKER_REPO}_${TAG}:${VERSION};
else
# Push
docker tag ${DOCKER_REPO}:${VERSION}-${TAG} ${DOCKER_REPO}:${VERSION}-${TAG};
docker tag ${DOCKER_REPO}:${VERSION}-${TAG} ${DOCKER_REPO}:${MINOR}-${TAG};
docker tag ${DOCKER_REPO}:${VERSION}-${TAG} ${DOCKER_REPO}:${MAJOR}-${TAG};

docker push ${DOCKER_REPO}:${VERSION}-${TAG};
docker push ${DOCKER_REPO}:${MINOR}-${TAG};
docker push ${DOCKER_REPO}:${MAJOR}-${TAG};
fi
# Push
docker tag ${DOCKER_REPO}:${VERSION}-${TAG} ${DOCKER_REPO}:${VERSION}-${TAG};
docker tag ${DOCKER_REPO}:${VERSION}-${TAG} ${DOCKER_REPO}:${MINOR}-${TAG};
docker tag ${DOCKER_REPO}:${VERSION}-${TAG} ${DOCKER_REPO}:${MAJOR}-${TAG};

docker push ${DOCKER_REPO}:${VERSION}-${TAG};
docker push ${DOCKER_REPO}:${MINOR}-${TAG};
docker push ${DOCKER_REPO}:${MAJOR}-${TAG};
}

for image in ${IMAGES_BASE_PATH}/*; do
Expand Down

0 comments on commit fb2a995

Please sign in to comment.