<commit_before>#!/bin/bash
set -e
DF=.dockpipe/Dockerfile
TARGET=$2
RANDOM=$(cat /dev/urandom | tr -cd 'a-f0-9' | head -c 32)
MODE="root"
rm -Rf $TARGET/.dockpipe
mkdir -p $TARGET/.dockpipe
while read COMMAND
do
	echo $COMMAND
	case "$(echo "$COMMAND" | awk '{print $1}')" in
		SUB)
			MODE="sub"
			echo "$COMMAND" | awk '{print "FROM " $2 "\n"}' > $TARGET/$DF-$MODE
		;;
		RETURN)
			RETURN_LID=$(cat /dev/urandom | tr -cd 'a-f0-9' | head -c 32)
			docker build -t dockpipe-$RETURN_LID -f $DF-$MODE $2
			CID=$(docker create dockpipe-$RETURN_LID)
			docker cp "$CID:$(echo "$COMMAND" | awk '{print $2}')" $TARGET/.dockpipe/ret-$RETURN_LID
			docker rm -f $CID
			
			MODE="root"
			echo "ADD $TARGET/.dockpipe/ret-$RETURN_LID $(echo "$COMMAND" | awk '{print $3}')" >> $TARGET/$DF-$MODE
		;;
		*)
			echo "$COMMAND" >> $TARGET/$DF-$MODE
		;;
	esac
done < $2/Dockerfile

# Build root image
docker build -t $1 -f $DF-root $2

# Push if given tag is on a registry
if [[ $1 =~ [^/]+/[^/]+/[^/]+ ]]; then
	docker push $1
fi
<commit_msg>Fixed Subbuilds without defined CMDs<commit_after>#!/bin/bash
set -e
DF=.dockpipe/Dockerfile
TARGET=$2
RANDOM=$(cat /dev/urandom | tr -cd 'a-f0-9' | head -c 32)
MODE="root"
rm -Rf $TARGET/.dockpipe
mkdir -p $TARGET/.dockpipe
while read COMMAND
do
	echo $COMMAND
	case "$(echo "$COMMAND" | awk '{print $1}')" in
		SUB)
			MODE="sub"
			echo "$COMMAND" | awk '{print "FROM " $2 "\n"}' > $TARGET/$DF-$MODE
		;;
		RETURN)
			RETURN_LID=$(cat /dev/urandom | tr -cd 'a-f0-9' | head -c 32)
			docker build -t dockpipe-$RETURN_LID -f $DF-$MODE $2
			CID=$(docker create dockpipe-$RETURN_LID "")
			docker cp "$CID:$(echo "$COMMAND" | awk '{print $2}')" $TARGET/.dockpipe/ret-$RETURN_LID
			docker rm -f $CID
			
			MODE="root"
			echo "ADD $TARGET/.dockpipe/ret-$RETURN_LID $(echo "$COMMAND" | awk '{print $3}')" >> $TARGET/$DF-$MODE
		;;
		*)
			echo "$COMMAND" >> $TARGET/$DF-$MODE
		;;
	esac
done < $2/Dockerfile

# Build root image
docker build -t $1 -f $DF-root $2

# Push if given tag is on a registry
if [[ $1 =~ [^/]+/[^/]+/[^/]+ ]]; then
	docker push $1
fi

{'fraction_non_alphanumeric': 0.20669856459330144, 'fraction_numerical': 0.01818181818181818, 'mean_word_length': 3.25, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, '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': '6131350', 'n_tokens_mistral': 931, 'n_tokens_neox': 833, 'n_words': 234}