<commit_before>#!/usr/bin/env bash
set -eux

cp -r /src/src /src/*.rs /src/Cargo.* .

DESTDIR=/src/releases

mkdir -p $DESTDIR/i386-linux
mkdir -p $DESTDIR/arm-linux

cargo build --release --target x86_64-unknown-linux-musl \
	&& strip /build/x86_64-unknown-linux-musl/release/spotty \
	&& cp /build/x86_64-unknown-linux-musl/release/spotty $DESTDIR/i386-linux/spotty-x86_64

cargo build --release --target i686-unknown-linux-musl \
	&& strip /build/i686-unknown-linux-musl/release/spotty \
	&& cp /build/i686-unknown-linux-musl/release/spotty $DESTDIR/i386-linux/spotty

cargo build --release --target aarch64-unknown-linux-gnu \
	&& aarch64-linux-gnu-strip /build/aarch64-unknown-linux-gnu/release/spotty \
	&& cp /build/aarch64-unknown-linux-gnu/release/spotty $DESTDIR/arm-linux/spotty-aarch64

cargo build --release --target arm-unknown-linux-gnueabihf \
	&& arm-linux-gnueabihf-strip /build/arm-unknown-linux-gnueabihf/release/spotty \
	&& cp /build/arm-unknown-linux-gnueabihf/release/spotty $DESTDIR/arm-linux/spotty-hf<commit_msg>Modularize the Docker build script<commit_after>#!/usr/bin/env bash
set -eux

cp -r /src/src /src/*.rs /src/Cargo.* .

DESTDIR=/src/releases

mkdir -p $DESTDIR/i386-linux
rm -f $DESTDIR/i386-linux/*

mkdir -p $DESTDIR/arm-linux
rm -f $DESTDIR/arm-linux/*

function build {
	echo Building for $1 to $3...
	cargo build --release --target $1 \
		&& $2 /build/$1/release/spotty \
		&& cp /build/$1/release/spotty $DESTDIR/$3
}

build x86_64-unknown-linux-musl strip i386-linux/spotty-x86_64
build i686-unknown-linux-musl strip i386-linux/spotty
build aarch64-unknown-linux-gnu aarch64-linux-gnu-strip arm-linux/spotty-aarch64
build arm-unknown-linux-gnueabihf arm-linux-gnueabihf-strip arm-linux/spotty-hf
{'fraction_non_alphanumeric': 0.15517241379310345, 'fraction_numerical': 0.04597701149425287, 'mean_word_length': 3.605820105820106, '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': '1964812', 'n_tokens_mistral': 755, 'n_tokens_neox': 695, 'n_words': 115}