.PHONY: all build

VERSION := $(shell date +%Y-%m-%d-%H.%M)

ifndef TESTING
    TAG := $(VERSION)
    all: info build
else
    TAG := TESTING__$(TESTING)__$(VERSION)
    all: info prepare_topics build
endif

ifdef CUSTOM_TAG
    TAG := $(TAG)__$(CUSTOM_TAG)
endif

info:
	@echo "Building image with TAG: $(TAG)"

prepare_topics:
	@echo "$(TESTING)" > src/topics.txt

build:
	ya package docker/package.json --docker --docker-push --docker-repository=soc --custom-version=$(TAG)
