> For the complete documentation index, see [llms.txt](https://docs-v2.hypertest.co/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs-v2.hypertest.co/user-guides/build-your-own-docker-image.md).

# Build your own Docker Image

## Build your own custom Docker Image of HyperTest <a href="#build-you-own-custom-docekr-image-for-hypertest" id="build-you-own-custom-docekr-image-for-hypertest"></a>

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

<details>

<summary> docker-image-HT-script.sh</summary>

```bash
#!/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} .
```

</details>

2. Create the file named .env&#x20;

<details>

<summary>.env</summary>

```
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>
```

</details>

3. Update the auth token, docker image name and node base image in .env file
4. Run the script using below command

```sh
sh  docker-image-HT-script.sh
```

The above script will do the following steps

1. Clone the repo[^1]sitory 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

{% hint style="success" %}
NOTE: The base image should have node (version 20 as of now) and npm installed in it
{% endhint %}

[^1]:
