<commit_before>#!/bin/bash -xe

PROJECT_DIR=$(cd `dirname $0`/.. && pwd)

BASE_DIR=$(cd `dirname $0` && pwd)

BUILD_IMAGE_CACHE_FILE=$HOME/.cache/docker/agfsapi4j-integration-test-build.docker.tar
BUILD_IMAGE_FQNAME=agfsapi4j-integration-test-build:local

if [ -f "$BUILD_IMAGE_CACHE_FILE" ]; then
  docker load -i $BUILD_IMAGE_CACHE_FILE
fi

docker build --tag $BUILD_IMAGE_FQNAME -f $BASE_DIR/Dockerfile $BASE_DIR

mkdir -p $(dirname $BUILD_IMAGE_FQNAME) && \
docker save -o $BUILD_IMAGE_CACHE_FILE $BUILD_IMAGE_FQNAME

CMD='mvn -Dcom.github.agfsapi4j.it.hostname=\$HOSTNAME -Pintegration-tests,sonar-upload clean verify'
if [ $# -ne 0 ]; then
  CMD="$*"
fi

echo "Command: $CMD"

docker run -ti --rm -e DEBUG_ENTRYPOINT=1 \
	-e WORKER_UID=$(id -u) \
	-e WORKER_GID=$(id -g) \
	-v $PROJECT_DIR/:/work \
	-v $HOME/.m2/repository/:/home/worker/.m2/repository/ \
	--privileged \
	$BUILD_IMAGE_FQNAME \
	"$CMD" <commit_msg>Improved docker image caching.<commit_after>#!/bin/bash -xe

PROJECT_DIR=$(cd `dirname $0`/.. && pwd)

BASE_DIR=$(cd `dirname $0` && pwd)

BUILD_IMAGE_FQNAME=agfsapi4j-integration-test-build:local

cd $BASE_DIR
BUILD_IMAGE_CHECKSUM=$(tar c assets/ Dockerfile | md5sum | cut -d' ' -f 1)
BUILD_IMAGE_CACHE_FILE=$HOME/.cache/docker/agfsapi4j-integration-test-build.$BUILD_IMAGE_CHECKSUM.docker.tar

if [ -f "$BUILD_IMAGE_CACHE_FILE" ]; then
  docker load -i $BUILD_IMAGE_CACHE_FILE
else
  rm $(dirname $BUILD_IMAGE_CACHE_FILE)/*.docker.tar || true
  docker build --tag $BUILD_IMAGE_FQNAME -f $BASE_DIR/Dockerfile $BASE_DIR
  mkdir -p $(dirname $BUILD_IMAGE_FQNAME) && \
  docker save -o $BUILD_IMAGE_CACHE_FILE $BUILD_IMAGE_FQNAME
fi

CMD='mvn -Dcom.github.agfsapi4j.it.hostname=\$HOSTNAME -Pintegration-tests,sonar-upload clean verify'
if [ $# -ne 0 ]; then
  CMD="$*"
fi

echo "Command: $CMD"

docker run -ti --rm -e DEBUG_ENTRYPOINT=1 \
	-e WORKER_UID=$(id -u) \
	-e WORKER_GID=$(id -g) \
	-v $PROJECT_DIR/:/work \
	-v $HOME/.m2/repository/:/home/worker/.m2/repository/ \
	--privileged \
	$BUILD_IMAGE_FQNAME \
	"$CMD" 
{'fraction_non_alphanumeric': 0.15931372549019607, 'fraction_numerical': 0.00980392156862745, 'mean_word_length': 4.27390180878553, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '397452', 'n_tokens_mistral': 858, 'n_tokens_neox': 818, 'n_words': 159}