Hypertest v2 Docs
HyperTest
  • Overview
    • How It Works?
  • SETUP GUIDE
    • Installation
      • Deploy HyperTest Server
      • Creating your first User
      • Adding your first service
      • Integrate SDK
        • Node.js
          • Node.js SDK with CJS
          • Node.js SDK with ESM
        • Java
    • Start a Test Run
      • CLI Login
      • Type References
      • Java
  • Interpreting Test Results
    • Test Results
    • Understanding Results Categories
    • Mock Not Found
    • AI Match Mocks
    • Accepting Changes
  • USER GUIDES
    • Node.js SDK
      • Limit memory usage
      • Supported NPM packages
      • Mock Dependencies Manually
      • Unmocking/Passing Through
      • Sampling and blocking requests
      • Manage Global Variables
      • Mocking Environment Variables
      • Tags
      • Set HTTP path patterns
      • Discard a test case(Request) while recording
      • Set Git Commit Hash
      • Code coverage based features
        • Continuous Coverage
        • Updating test coverage
        • Running post test deduplication
        • Only testing modified requests
        • Ignore differences for unmodified requests
      • Experimental flags
      • Manual Request
      • Only testing modified requests
      • Server hooks
    • Java SDK
      • Sampling and blocking requests
      • Mock Dependencies Manually
      • Tags
      • Unmocking/Passing Through
      • Code Coverage Setup and Report Generation
      • Supported Java packages
    • Build your own Docker Image
    • CLI Config
    • Ignoring Differences
      • Type References for Filter functions
  • Impact Features
    • Fast Mode
    • Code Coverage Report
    • Delete Recorded Requests
    • Inter Service Testing
  • Release History
    • Slack Integration
    • Version History
Powered by GitBook
On this page
  1. USER GUIDES

Build your own Docker Image

Build your own custom Docker Image of HyperTest

HyperTest's docker images uses node:20-bookworm-slim as a base docker image. If you want to use your own node image as base image for HyperTest, you can do so and rebuild the image with the following script.

To build your own custom image follow the steps given in this page

  1. Create the file named docker-image-HT-script.sh

docker-image-HT-script.sh
#!/bin/bash

# Load environment variables from .env file
if [ -f .env ]; then
    export $(cat .env | grep -v ^# | xargs)
fi

# Clone the git repo
git clone https://${GIT_FT_PAT}@github.com/hypertestco/v2-artifacts.git

# Navigate into the cloned repository
cd v2-artifacts || exit

# Checkout to version of HT
git checkout ${HYPERTEST_VERSION}

# Function to parse dependenciesVersion.txt and extract version numbers
parse_dependencies() {
    local file="dependenciesVersion.txt"
    if [ -f "$file" ]; then
        prismaEngVersion=$(grep -E "^prismaEngVersion:" "$file" | sed 's/prismaEngVersion://' | tr -d '[:space:]')
        bcryptVersion=$(grep -E "^bcryptVersion:" "$file" | sed 's/bcryptVersion://' | tr -d '[:space:]')
    else
        echo "Error: dependenciesVersion.txt not found"
        exit 1
    fi
}

# Parse dependenciesVersion.txt to extract version numbers
parse_dependencies

# Build Docker image
docker build -t ${DOCKER_IMAGE_NAME} \
             --build-arg NODE_BASE_IMAGE=${NODE_BASE_IMAGE} \
             --build-arg PRIMSA_ENG_PKG_VERSION=${PRIMSA_ENG_PKG_VERSION} \
             --build-arg BCRYPT_VERSION=${BCRYPT_VERSION} .
  1. Create the file named .env

.env
GIT_FT_PAT=<Fine_grained_PAT_received from HT Team(diff than NPM)>
HYPERTEST_VERSION=<Get the latest version from HT team>
DOCKER_IMAGE_NAME=<c_docker_image_name>
NODE_BASE_IMAGE=<Node_base_image, we are using node:20-bookworn-slim>
  1. Update the auth token, docker image name and node base image in .env file

  2. Run the script using below command

sh  docker-image-HT-script.sh

The above script will do the following steps

  1. Clone the rsitory containing docker artifacts

  2. Fetch package versions from repo content for a few packages required to run HT

  3. Build a docker image based on the name and base image you passed in .env file

NOTE: The base image should have node (version 20 as of now) and npm installed in it

PreviousSupported Java packagesNextCLI Config

Last updated 5 months ago