DOCKERCOMPOSEPATH=./srcs/docker-compose.yml

#dev allow hot reload.
dev:
	docker compose -f ${DOCKERCOMPOSEPATH} up -d --build
	@make start
	@docker ps


#prod only the needed files ares presents inside the container
prod:
	docker compose -f ${DOCKERCOMPOSEPATH} up -d --build prod
	@make start_prod
	@docker ps

start:
	docker compose -f ${DOCKERCOMPOSEPATH} start
	docker logs --follow srcs-backend_dev-1

start_dev:
	docker compose -f ${DOCKERCOMPOSEPATH} start dev
	docker logs --follow srcs-backend_dev-1

start_prod:
	docker compose -f ${DOCKERCOMPOSEPATH} start prod

restart:stop
		@make up

down:
	docker compose -f ${DOCKERCOMPOSEPATH} -v down

destroy:
	# rm -rf ./srcs/requirements/nestjs/api_back/node_modules/
	# rm -rf ./srcs/requirements/nestjs/api_back/dist
	# rm -rf ./srcs/requirements/svelte/api_front/node_modules/
	# rm -rf ./srcs/requirements/svelte/api_front/public/build
	docker compose -f ${DOCKERCOMPOSEPATH} down -v --rmi all --remove-orphans
	docker ps -aq |  xargs --no-run-if-empty docker rm -f
	docker images -aq | xargs --no-run-if-empty docker rmi -f
	docker volume ls -q | xargs --no-run-if-empty docker volume rm

stop:
	docker compose -f ${DOCKERCOMPOSEPATH} stop
