.ONESHELL:
SHELL=/bin/bash
.PHONY: build

config ?= .env

include $(config)
export $(shell sed 's/=.*//' $(config))

GIT_COMMIT := $(shell git rev-parse --short HEAD)

all: lock build-image run-local

lock:
@echo 'Updating pixi lockfile'
	pixi update


build-image:
	@echo 'Building release ${CONTAINER_REGISTRY}/$(IMAGE_NAME):$(IMAGE_TAG)'
	docker compose -f docker-compose-build.yaml build --build-arg SOURCE_COMMIT=$(GIT_COMMIT) app

push-registry:
	az acr login --name $(shell echo $(CONTAINER_REGISTRY) | cut -d. -f1)
	docker push ${CONTAINER_REGISTRY}/$(IMAGE_NAME):$(IMAGE_TAG)

run-local:
	docker compose -f docker-compose-dev.yaml up

test:
	pixi run -e dev test

lint:
	pixi run -e dev lint

format:
	pixi run -e dev format

typecheck:
	pixi run -e dev typecheck

build-docs:
	jupyter-book build docs

clean-docs:
	jupyter-book clean docs
