.PHONY: push test build


build:
	docker build -t com402/hw10ex1 .

run: build
	docker run --rm -it -p 8080:8080 --name hw10ex1 com402/hw10ex1

test: build
	docker run --rm -d -p 8080:8080 --name hw10ex1 com402/hw10ex1
	docker cp solution.py hw10ex1:/root/
	sleep 5
	docker exec -it hw10ex1 /root/solution.py > test_tmp.txt
	python3 solution.py > test_tmp.txt
	docker stop hw10ex1
	tail -2 test_tmp.txt > test_solution.txt
	diff solution_compare.txt test_solution.txt
	rm test_tmp.txt
	rm test_solution.txt
	echo "TEST [hw10_EX1] PASSED!!"

push: build
	# docker login --username com402
	docker build -t com402/hw10ex1 . --push
