# makefile for sample commands
#

default: build-tds build-sample-docker-images

build-tds: clean build-tds-docker-images

build-sample: clean build-sample-docker-images

clean:
	rm -rf ./tds-front
	rm -rf ./tds-back
	rm -rf ./sample-front

build-tds-docker-images:
	cd ../familySite1Frontend && ng build
	mkdir -p ./tds-front/dist 
	cp -r ../familySite1Frontend/dist/familySite1 ./tds-front/dist/
	cp ../familySite1Frontend/Dockerfile ./tds-front/
	cd ../familySite1Backend && mvn package
	mkdir -p ./tds-back/target
	cp -r ../familySite1Backend/target/*.jar ./tds-back/target/
	cp ../familySite1Backend/Dockerfile ./tds-back/
	chmod a+x ./tds-back/target/*.jar

build-sample-docker-images:
	cd ../familySite1Frontend && ng build -c sample
	mkdir -p ./sample-front/dist 
	cp -r ../familySite1Frontend/dist/familySite1 ./sample-front/dist/
	cp ../familySite1Frontend/Dockerfile ./sample-front/

deploy:
	docker compose up -d --build --remove-orphans
