Skip to content
Snippets Groups Projects
Makefile 1.82 KiB
Newer Older
UID := $(id -u)
GID := $(id -g)
Tifenn Guillas's avatar
Tifenn Guillas committed
NAME_APP=anis-client
François Agneray's avatar
François Agneray committed

# UID := 1000
# GID := 1000
François Agneray's avatar
François Agneray committed

list:
	@echo ""
	@echo "Useful targets:"
	@echo ""
	@echo "  install      > install node modules dependancies (node_modules)"
Tifenn Guillas's avatar
Tifenn Guillas committed
	@echo "  start        > run a dev server for $(NAME_APP) application (in memory)"
	@echo "  stop         > stop the dev server for $(NAME_APP) application"
	@echo "  restart      > restart the dev server for $(NAME_APP) (container)"
	@echo "  status       > display $(NAME_APP) container status"
	@echo "  test         > run $(NAME_APP) tests"
	@echo "  test-watch   > run $(NAME_APP) tests on every file change"
Tifenn Guillas's avatar
Tifenn Guillas committed
	@echo "  report       > open the code coverage report in a browser (only available for Linux)"
Tifenn Guillas's avatar
Tifenn Guillas committed
	@echo "  dist         > generate the angular dist application (html, css, js)"
	@echo "  logs         > display $(NAME_APP) container logs"
	@echo "  shell        > shell into $(NAME_APP) container"
François Agneray's avatar
François Agneray committed
	@echo ""

install:
	@docker build -t anis-node conf-dev && docker run --init -it --rm --user $(UID):$(GID) \
	-v $(CURDIR):/project \
	-w /project anis-node yarn install

start:
	@docker build -t anis-node conf-dev && docker run --init -it --rm --user $(UID):$(GID) \
Tifenn Guillas's avatar
Tifenn Guillas committed
	--name $(NAME_APP) \
François Agneray's avatar
François Agneray committed
	-p 4200:4200 \
Tifenn Guillas's avatar
Tifenn Guillas committed
	-p 9876:9876 \
François Agneray's avatar
François Agneray committed
	-v $(CURDIR):/project -d \
	-w /project anis-node ng serve --host=0.0.0.0 --disable-host-check --port 4200

restart: stop start
François Agneray's avatar
François Agneray committed

stop:
Tifenn Guillas's avatar
Tifenn Guillas committed
	@docker stop $(NAME_APP)
François Agneray's avatar
François Agneray committed

restart: stop start

Tifenn Guillas's avatar
Tifenn Guillas committed
status:
	@docker ps -f name=$(NAME_APP)

Tifenn Guillas's avatar
Tifenn Guillas committed
test:
Tifenn Guillas's avatar
Tifenn Guillas committed
	@docker exec -ti $(NAME_APP) ng test --no-watch
Tifenn Guillas's avatar
Tifenn Guillas committed

test-watch:
	@docker exec -ti $(NAME_APP) ng test

Tifenn Guillas's avatar
Tifenn Guillas committed
report:
	xdg-open var/coverage/index.html

Tifenn Guillas's avatar
Tifenn Guillas committed
dist:
François Agneray's avatar
François Agneray committed
	@docker build -t anis-node conf-dev && docker run --init -it --rm --user $(UID):$(GID) \
	-v $(CURDIR):/project \
	-w /project anis-node ng build --prod

Tifenn Guillas's avatar
Tifenn Guillas committed
	@docker logs -f -t $(NAME_APP)
François Agneray's avatar
François Agneray committed

Tifenn Guillas's avatar
Tifenn Guillas committed
shell:
Tifenn Guillas's avatar
Tifenn Guillas committed
	@docker exec -ti $(NAME_APP) bash