From 1ebe6e76b17af8f812144edcbffe19e439ae5e9a Mon Sep 17 00:00:00 2001 From: Mathieu Piot Date: Fri, 29 Mar 2019 10:45:26 +0100 Subject: [PATCH] Add some fixes --- Dockerfile | 6 ++++-- Makefile | 32 +++++++++++++++++++++----------- 2 files changed, 25 insertions(+), 13 deletions(-) diff --git a/Dockerfile b/Dockerfile index 7c755fddba..3fe91b2a41 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,6 +16,8 @@ ARG APCU_VERSION WORKDIR /app +EXPOSE 80 + # Install paquet requirements RUN export PHP_CPPFLAGS="${PHP_CPPFLAGS} -std=c++11"; \ set -ex; \ @@ -23,7 +25,6 @@ RUN export PHP_CPPFLAGS="${PHP_CPPFLAGS} -std=c++11"; \ apt-get update; \ apt-get install -qy --no-install-recommends \ libzip-dev \ - git \ ; \ # Compile ICU (required by intl php extension) curl -L -o /tmp/icu.tar.gz http://download.icu-project.org/files/icu4c/${ICU_VERSION}/icu4c-$(echo ${ICU_VERSION} | sed s/\\./_/g)-src.tgz; \ @@ -98,6 +99,7 @@ RUN set -ex; \ apt-get update; \ apt-get install -qy --no-install-recommends \ unzip \ + git \ ; \ # Clean aptitude cache and tmp directory apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*; @@ -154,7 +156,7 @@ RUN yarn install && yarn build && rm -R node_modules ##################################### FROM composer:${COMPOSER_VERSION} as vendor-builder -COPY --from=assets-builder /app /app +COPY --chown=www-data --from=assets-builder /app /app WORKDIR /app RUN APP_ENV=prod composer install -o -n --no-ansi --no-dev diff --git a/Makefile b/Makefile index 6b3867f1be..5baa38d918 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ DOCKER_COMPOSE?=docker-compose EXEC?=$(DOCKER_COMPOSE) exec app -CONSOLE=bin/console +CONSOLE=php bin/console PHPCSFIXER?=$(EXEC) php -d memory_limit=1024m vendor/bin/php-cs-fixer .DEFAULT_GOAL := help @@ -8,12 +8,13 @@ PHPCSFIXER?=$(EXEC) php -d memory_limit=1024m vendor/bin/php-cs-fixer .PHONY: db-diff db-migrate db-rollback db-fixtures db-validate .PHONY: watch assets assets-build .PHONY: tests lint lint-symfony lint-yaml lint-twig lint-xliff php-cs php-cs-fix security-check test-schema test-all -.PHONY: build up perm -.PHONY: docker-compose.override.yml +.PHONY: deps +.PHONY: build up perm docker-compose.override.yml help: @grep -E '(^[a-zA-Z_-]+:.*?##.*$$)|(^##)' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[32m%-30s\033[0m %s\n", $$1, $$2}' | sed -e 's/\[32m##/[33m/' + ## ## Project setup ##--------------------------------------------------------------------------- @@ -27,7 +28,7 @@ stop: restart: ## Restart docker containers $(DOCKER_COMPOSE) restart -install: docker-compose.override.yml build up vendor perm ## Create and start docker containers +install: docker-compose.override.yml build up deps perm ## Create and start docker containers uninstall: stop ## Remove docker containers $(DOCKER_COMPOSE) rm -vf @@ -48,7 +49,7 @@ clear: perm rm -f var/.php_cs.cache clean: clear ## Clear and remove dependencies - rm -rf vendor + rm -rf vendor node_modules ## @@ -81,9 +82,10 @@ watch: node_modules assets: node_modules ## Build the development version of the assets $(EXEC) yarn dev -assets-build: node_modules ## Build the production version of the assets +assets-build: node_modules ## Build the production version of the assets $(EXEC) yarn build + ## ## Tests ##--------------------------------------------------------------------------- @@ -91,7 +93,7 @@ assets-build: node_modules tests: ## Run all the PHP tests $(EXEC) bin/phpunit -lint: lint-symfony php-cs ## Run lint on Twig, YAML, PHP and Javascript files +lint: lint-symfony php-cs ## Run lint on Twig, YAML, XLIFF, and PHP files lint-symfony: lint-yaml lint-twig lint-xliff ## Lint Symfony (Twig and YAML) files @@ -101,13 +103,13 @@ lint-yaml: lint-twig: ## Lint Twig files $(EXEC) $(CONSOLE) lint:twig templates -lint-xliff: ## Lint Translation files +lint-xliff: ## Lint Translation files $(EXEC) $(CONSOLE) lint:xliff translations php-cs: vendor ## Lint PHP code $(PHPCSFIXER) fix --diff --dry-run --no-interaction -v -php-cs-fix: vendor ## Lint and fix PHP code to follow the convention +php-cs-fix: vendor ## Fix PHP code to follow the convention $(PHPCSFIXER) fix security-check: vendor ## Check for vulnerable dependencies @@ -116,7 +118,15 @@ security-check: vendor test-schema: vendor ## Test the doctrine Schema $(EXEC) $(CONSOLE) doctrine:schema:validate --skip-sync -vvv --no-interaction -test-all: lint test-schema security-check tests ## Lint all, check vulnerable dependencies, run PHP tests +test-all: lint test-schema security-check tests ## Lint all, run schema and security check, then unit and functionnal tests + + +## +## Dependencies +##--------------------------------------------------------------------------- + +deps: vendor assets ## Install the project dependencies + ## @@ -147,7 +157,7 @@ vendor: composer.lock $(EXEC) composer install -n composer.lock: composer.json - @echo compose.lock is not up to date. + @echo composer.lock is not up to date. node_modules: yarn.lock $(EXEC) yarn install