<commit_before># Makefile for the Docker image bandsintown/alpine
# MAINTAINER: <NAME> <<EMAIL>>

SHELL := bash
.SHELLFLAGS := -eu -o pipefail -c
.PHONY: all build release test

IMAGE = bandsintown/alpine
IMAGE_TEST=$(IMAGE)-test
VERSIONS = 3.5
VERSION =
BUILD_NUM = $(shell git rev-parse --short HEAD)

all:
	@echo "Supported versions: $(VERSIONS)"
	@echo "Available targets:"
	@echo "  * build - build images"
	@echo "  * test  - run integration tests"
	@echo "  * release  - git tag build and push to Docker Hub"

build:
	@$(foreach var,$(VERSIONS),$(MAKE) do/build VERSION=$(var);)
	@$(MAKE) do/tag-latest VERSION=$(word $(words $(VERSIONS)),$(VERSIONS))

do/build:
	@echo "=> building $(IMAGE):$(VERSION)-$(BUILD_NUM)"
	docker build -t $(IMAGE):$(VERSION) -f versions/$(VERSION)/Dockerfile .
	docker tag $(IMAGE):$(VERSION) $(IMAGE):$(VERSION)-$(BUILD_NUM)

test:
	@$(foreach var,$(VERSIONS),$(MAKE) do/test VERSION=$(var);)

do/test: do/build-test
	@echo "=> running tests for $(IMAGE):$(VERSION)-$(BUILD_NUM)"
	docker run -e S6_LOGGING=1 $(IMAGE_TEST):$(VERSION)-$(BUILD_NUM) bats /tests/image
	docker run -e S6_LOGGING=1 --dns=8.8.4.4 --dns-search=10.0.0.1.xip.io $(IMAGE_TEST):$(VERSION)-$(BUILD_NUM) bats /tests/dnsmasq/01-resolve_dns.bats
	docker run -e S6_LOGGING=1 --dns 8.8.4.4 --dns 8.8.8.8 --dns-search google.com --dns-search video.google.com $(IMAGE_TEST):$(VERSION)-$(BUILD_NUM) bats /tests/dnsmasq/02-resolve_dns_multiple.bats

do/build-test:
	docker build -t $(IMAGE_TEST):$(VERSION)-$(BUILD_NUM) -f tests/Dockerfile-$(VERSION) .

release: git-tag
	@$(foreach var,$(VERSIONS),$(MAKE) do/release VERSION=$(var);)
	docker push $(IMAGE):latest

do/release:
	docker push $(IMAGE):$(VERSION)
	docker push $(IMAGE):$(VERSION)-$(BUILD_NUM)

git-tag:
	git tag -f -a build-$(BUILD_NUM) -m "Release CI build $(BUILD_NUM)"
	git push -f --tags

do/tag-latest:
	docker tag $(IMAGE):$(VERSION) $(IMAGE):latest<commit_msg>Update Makefile<commit_after># Makefile for the Docker image bandsintown/alpine
# MAINTAINER: <NAME> <<EMAIL>>

SHELL := bash
.SHELLFLAGS := -eu -o pipefail -c
.PHONY: all build release test

IMAGE = bandsintown/alpine
IMAGE_TEST=$(IMAGE)-test
VERSIONS = 3.4 3.5
VERSION =
BUILD_NUM = $(shell git rev-parse --short HEAD)

all:
	@echo "Supported versions: $(VERSIONS)"
	@echo "Available targets:"
	@echo "  * build - build images"
	@echo "  * test  - run integration tests"
	@echo "  * release  - git tag build and push to Docker Hub"

build:
	@$(foreach var,$(VERSIONS),$(MAKE) do/build VERSION=$(var);)
	@$(MAKE) do/tag-latest VERSION=$(word $(words $(VERSIONS)),$(VERSIONS))

do/build:
	@echo "=> building $(IMAGE):$(VERSION)-$(BUILD_NUM)"
	docker build -t $(IMAGE):$(VERSION) -f versions/$(VERSION)/Dockerfile .
	docker tag $(IMAGE):$(VERSION) $(IMAGE):$(VERSION)-$(BUILD_NUM)

test:
	@$(foreach var,$(VERSIONS),$(MAKE) do/test VERSION=$(var);)

do/test: do/build-test
	@echo "=> running tests for $(IMAGE):$(VERSION)-$(BUILD_NUM)"
	docker run -e VERSION=$(VERSION) $(IMAGE_TEST):$(VERSION)-$(BUILD_NUM) bats /tests/image
	docker run -e VERSION=$(VERSION) --dns=8.8.4.4 --dns-search=10.0.0.1.xip.io $(IMAGE_TEST):$(VERSION)-$(BUILD_NUM) bats /tests/dnsmasq/01-resolve_dns.bats
	docker run -e VERSION=$(VERSION) --dns 8.8.4.4 --dns 8.8.8.8 --dns-search google.com --dns-search video.google.com $(IMAGE_TEST):$(VERSION)-$(BUILD_NUM) bats /tests/dnsmasq/02-resolve_dns_multiple.bats

do/build-test:
	docker build -t $(IMAGE_TEST):$(VERSION)-$(BUILD_NUM) -f versions/$(VERSION)/Dockerfile-tests .

release: git-tag
	@$(foreach var,$(VERSIONS),$(MAKE) do/release VERSION=$(var);)
	docker push $(IMAGE):latest

do/release:
	docker push $(IMAGE):$(VERSION)
	docker push $(IMAGE):$(VERSION)-$(BUILD_NUM)

git-tag:
	git tag -f -a build-$(BUILD_NUM) -m "Release CI build $(BUILD_NUM)"
	git push -f --tags

do/tag-latest:
	docker tag $(IMAGE):$(VERSION) $(IMAGE):latest
{'fraction_non_alphanumeric': 0.19722293648752892, 'fraction_numerical': 0.013885317562355361, 'mean_word_length': 4.797317436661699, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 8, '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': '5050995', 'n_tokens_mistral': 1495, 'n_tokens_neox': 1444, 'n_words': 343}