<commit_before>build: empire_base.tar.gz push

empire_base.tar.gz: packer.json
	packer build packer.json

check-aws:
ifndef AWS_ACCESS_KEY_ID
	$(error Must have AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY defined in environment)
endif

push: check-aws
	aws s3 cp empire_base.tar.gz s3://empire-image-artifacts/empire_base.tar.gz

clean:
	rm empire_base.tar.gz<commit_msg>Clean up, use more variables<commit_after>ARTIFACTDIR=../../artifacts
ARTIFACT=$(ARTIFACTDIR)/empire_base.tar.gz
PACKERLOG=$(ARTIFACTDIR)/base_packer.csv
AMIFILE=$(ARTIFACTDIR)/ami.txt

.PHONY: image check-aws clean

image: $(ARTIFACT) $(AMIFILE) push

$(ARTIFACT): packer.json scripts/base.sh
	if [ ! -d $(ARTIFACTDIR) ]; then mkdir -p $(ARTIFACTDIR); fi
	packer build -machine-readable packer.json 2>&1 | tee $(PACKERLOG)

$(AMIFILE): $(PACKERLOG)
	awk 'BEGIN { FS = "," }; /base-ubuntu-east,artifact,0,id/ {print $6}' $(PACKERLOG) | cut -f 2 -d : > $(AMIFILE)

check-aws:
ifndef AWS_ACCESS_KEY_ID
	$(error Must have AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY defined in environment)
endif

push: check-aws
	aws s3 cp $(ARTIFACT) s3://empire-image-artifacts/empire_base.tar.gz
	aws s3 cp $(AMIFILE) s3://empire-image-artifacts/ami.txt

clean:
	rm -rf build $(ARTIFACT) $(AMIFILE)
{'fraction_non_alphanumeric': 0.1380686352753392, 'fraction_numerical': 0.008778930566640064, 'mean_word_length': 5.087378640776699, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '3072952', 'n_tokens_mistral': 505, 'n_tokens_neox': 484, 'n_words': 109}