Skip to content
Snippets Groups Projects
Makefile 2.77 KiB
Newer Older
  • Learn to ignore specific revisions
  • François Agneray's avatar
    François Agneray committed
    UID := 1000
    GID := 1000
    
    list:
    	@echo ""
    	@echo "Useful targets:"
    	@echo ""
    
    François Agneray's avatar
    François Agneray committed
    	@echo "  rebuild          > rebuild all images and start containers for dev only"
    	@echo "  start            > start containers"
    	@echo "  restart          > restart containers"
    	@echo "  stop             > stop and kill running containers"
    	@echo "  status           > display stack containers status"
    	@echo "  logs             > display containers logs"
    	@echo "  install_client   > install client dependencies"
    	@echo "  shell_client     > shell into angular client container"
    	@echo "  build_client     > generate the angular client dist application (html, css, js)"
    	@echo "  test_client      > Starts the angular client unit tests"
    
    	@echo "  client_coverage  > Run nginx web server test client coverage"
    
    François Agneray's avatar
    François Agneray committed
    	@echo "  install_server   > install server dependencies"
    	@echo "  shell_server     > shell into php server container"
    	@echo "  test_server      > Starts the server php unit tests"
    	@echo "  phpcs            > run php code sniffer test suite"
    	@echo "  shell_services   > shell into python services"
    	@echo "  create-db        > create a database for dev only (need token_enabled=0)"
    	@echo "  remove-pgdata    > remove the anis-next database"
    
    François Agneray's avatar
    François Agneray committed
    	@echo ""
    
    rebuild:
    	@docker-compose up --build -d
    
    start:
    	@docker-compose up -d
    
    restart: stop start
    
    stop:
    	@docker-compose kill
    	@docker-compose rm -v --force
    
    status:
    	@docker-compose ps
    
    logs:
    	@docker-compose logs -f -t
    
    install_client:
    
    François Agneray's avatar
    François Agneray committed
    	@docker run --init -it --rm --user $(UID):$(GID) \
    
    François Agneray's avatar
    François Agneray committed
    	-v $(CURDIR)/client:/project \
    
    François Agneray's avatar
    François Agneray committed
    	-w /project node:16-slim yarn install
    
    François Agneray's avatar
    François Agneray committed
    
    shell_client:
    	@docker-compose exec client bash
    
    build_client:
    
    François Agneray's avatar
    François Agneray committed
    	@docker-compose exec client ng build
    
    François Agneray's avatar
    François Agneray committed
    
    test_client:
    
    	@docker-compose exec client npx jest
    
    client_coverage:
    	@docker run --name anis-client-code-coverage -d -p 8888:80 -v $(CURDIR)/client/coverage/anis-client:/usr/share/nginx/html:ro nginx
    
    François Agneray's avatar
    François Agneray committed
    
    install_server:
    	@docker run --init -it --rm --user $(UID):$(GID) \
    	-e COMPOSER_CACHE_DIR=/dev/null \
    	-v $(CURDIR)/server:/project \
    	-w /project jakzal/phpqa:php8.0 composer install --ignore-platform-reqs
    
    shell_server:
    	@docker-compose exec server bash
    
    test_server:
    	@docker run --init -it --rm --user $(UID):$(GID) \
    	-v $(CURDIR)/server:/project \
    	-w /project jakzal/phpqa:php8.0 phpdbg -qrr ./vendor/bin/phpunit --bootstrap ./tests/bootstrap.php \
    	--whitelist src --colors --coverage-html ./phpunit-coverage ./tests
    
    phpcs:
    	@docker run --init -it --rm --user $(UID):$(GID) \
    	-v $(CURDIR)/server:/project \
    	-w /project jakzal/phpqa:php8.0 phpcs --standard=PSR12 --extensions=php --colors src tests
    
    
    François Agneray's avatar
    François Agneray committed
    shell_services:
    	@docker-compose exec services bash
    
    
    François Agneray's avatar
    François Agneray committed
    create-db:
    
    François Agneray's avatar
    François Agneray committed
    	@docker-compose exec server sh /mnt/init-keycloak.sh
    	@docker-compose exec server sh /mnt/create-db.sh
    
    François Agneray's avatar
    François Agneray committed
    
    remove-pgdata:
    	@docker volume rm anis-next_pgdata