<commit_before>
build_docker_image() {
  local directory="$1"

  echo "$directory"

  pushd $directory
  ./build.sh 2>&1 >> build.log || return 1
  docker build . -t "cvmfs/$(basename $directory)" 2>&1 >> docker.log
  popd
}
export -f build_docker_image

parallel="1"

while getopts "p:" opt; do
  case $opt in 
    p) 
      parallel="$OPTARG"
      ;;
  esac
done

ls images/*/Dockerfile | xargs -n 1 dirname | xargs -n 1 -P "$parallel" -I {} bash -c 'build_docker_image "{}"'

<commit_msg>tidy up output<commit_after>
build_docker_image() {
  local directory="$1"

  echo "Working on $directory"

  pushd $directory > /dev/null
  ./build.sh >> build.log 2>&1 || echo "Error on $directory"; return 1
  docker build . -t "cvmfs/$(basename $directory)" >> docker.log 2>&1
  popd > /dev/null
}
export -f build_docker_image

parallel="1"

while getopts "p:" opt; do
  case $opt in 
    p) 
      parallel="$OPTARG"
      ;;
  esac
done

ls images/*/Dockerfile | xargs -n 1 dirname | xargs -n 1 -P "$parallel" -I {} bash -c 'build_docker_image "{}"'


{'fraction_non_alphanumeric': 0.15458015267175573, 'fraction_numerical': 0.01717557251908397, 'mean_word_length': 3.1137254901960785, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, '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': '2721150', 'n_tokens_mistral': 417, 'n_tokens_neox': 380, 'n_words': 114}