Skip to content
Snippets Groups Projects
Makefile 2.66 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 ""
    	@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 "  install_server > install server dependencies"
    	@echo "  shell_server   > shell into python server container"
    	@echo "  test_server    > Starts the server php unit tests"
    	@echo "  phpcs          > run php code sniffer test suite"
    	@echo "  create-db      > create a database for dev only (need token_enabled=0)"
    	@echo "  remove-pgdata  > remove the anis-next database"
    	@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:
    	@docker build -f ./conf-dev/angular-cli.dockerfile -t angular-cli . && docker run --init -it --rm --user $(UID):$(GID) \
    	-v $(CURDIR)/client:/project \
    	-w /project angular-cli yarn install
    
    shell_client:
    	@docker-compose exec client bash
    
    build_client:
    	@docker build -f ./conf-dev/angular-cli.dockerfile -t angular-cli . && docker run --init -it --rm --user $(UID):$(GID) \
    	-v $(CURDIR)/client:/project \
    	-w /project angular-cli ng build --prod
    
    test_client:
    	@docker-compose exec client ng test --no-watch --code-coverage
    
    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
    
    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