<commit_before>#! /bin/bash
#
# TODO adapt this for Windows

# TODO add package.json config arguments to configure the container name,
#       ports and imageserver version

CONTAINER_NAME=""


docker run -d --name $CONTAINER_NAME \
    -v $PWD/plotly.js:/var/www/streambed/image_server/plotly.js \
    -p 9010:9010 -p 2022:22 plotly/imageserver:[version]

docker exec -i $CONTAINER_NAME /bin/bash \
    -c "cd /var/www/streambed/image_server/plotly.js && \
        cp -f test/image/index.html ../server_app/index.html && \
        monit restart nw1 && \
        sleep 5 && \
        node test/image/compare_pixels_test.js"
        <commit_msg>add image docker test bash wrapper in tasks/<commit_after>#! /bin/bash
#
# TODO adapt this for Windows
#
# TODO add package.json config arguments to configure:
#       - container name,
#       - ports and
#       - imageserver version
#
# ===============================================================================

CONTAINER_NAME="imagetest"
IMAGE_NAME="registry.plot.ly:5000/imageserver"
IMAGE_VERSION="1.3.0"

# Run docker container:
#
# docker run -d --name $CONTAINER_NAME \
#     -v $PWD/plotly.js:/var/www/streambed/image_server/plotly.js \
#     -p 9010:9010 -p 2022:22 \
#     $IMAGE_NAME:[$IMAGE_VERSION]

CMD=(
    "cd /var/www/streambed/image_server/plotly.js &&"
    "cp -f test/image/index.html ../server_app/index.html &&"
    "monit restart nw1 &&"
    "sleep 5 &&"
    "node test/image/compare_pixels_test.js $1"
)

docker exec -i $CONTAINER_NAME /bin/bash -c "${CMD[*]}"
{'fraction_non_alphanumeric': 0.1841249186727391, 'fraction_numerical': 0.026024723487312947, 'mean_word_length': 3.079575596816976, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3995326', 'n_tokens_mistral': 581, 'n_tokens_neox': 528, 'n_words': 120}