<commit_before>#!/bin/bash

set -e

test -x ./build.sh
test -d ./001-ubuntu

TAG=$(date +%F-%H-%M)
rc=0

dock() {
	if [ -e /usr/bin/docker ]; then
		docker $@
	else
		docker.io $@
	fi
}

function build-image() {
	NAME=$TAG-$1
	if ! dock build -t $NAME $NAME; then
		rc=1
		echo "non zero exito status from docker build -t $NAME $NAME: $rc"
	fi
}

function run-image() {
	NAME=$TAG-$1
	if ! (docker.io run --privileged=true -i --name=$NAME $NAME -c '/build/build_tplino-core.sh' && dock commit $NAME $NAME) ; then
		rc=1
		echo "non zero exito status from docker run --rm -t -i --name=$NAME $NAME: $rc"
	fi
}

for stage in [0-9][0-9][0-9]-*
do
	if [ -e $stage/privileged ]; then
		echo
		echo "starting to create image from $stage"
		echo
		build-image $stage
		run-image $stage
		[ $rc -ne 0 ] && exit $rc
	else
		echo
		echo "starting to create image from $stage"
		echo
		build-image $stage
		[ $rc -ne 0 ] && exit $rc
	fi
done

exit $rc<commit_msg>add a check for build or run dependend on a file in the dockerfile dir<commit_after>#!/bin/bash

set -e

test -x ./build.sh
test -d ./001-ubuntu

TAG=$(date +%F-%H-%M)
rc=0

dock() {
	if [ -e /usr/bin/docker ]; then
		docker $@
	else
		docker.io $@
	fi
}

function build-image() {
	NAME=$TAG-$1
	if ! dock build -t $NAME $NAME; then
		rc=1
		echo "non zero exito status from docker build -t $NAME $NAME: $rc"
	fi
}

function run-image() {
	NAME=$TAG-$1
	if ! (docker.io run --privileged=true -i --name=$NAME $NAME -c '/build/build_tplino-core.sh' && dock commit $NAME $NAME) ; then
		rc=1
		echo "non zero exito status from docker run --rm -t -i --name=$NAME $NAME: $rc"
	fi
}

for stage in [0-9][0-9][0-9]-*
do
	if [ -e $stage/run ]; then
		echo
		echo "starting to create image from $stage"
		echo
		build-image $stage
		run-image $stage
		[ $rc -ne 0 ] && exit $rc
	elif [ -e $stage/build ]; then
		echo
		echo "starting to create image from $stage"
		echo
		build-image $stage
		[ $rc -ne 0 ] && exit $rc
	else
		echo "run or build not specified"
	fi
done

exit $rc
{'fraction_non_alphanumeric': 0.1594059405940594, 'fraction_numerical': 0.015841584158415842, 'mean_word_length': 2.7565055762081783, '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': '4162186', 'n_tokens_mistral': 875, 'n_tokens_neox': 800, 'n_words': 275}