Skip to content

Commit

Permalink
Add some fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mpiot committed Mar 29, 2019
1 parent 561eb0a commit 1ebe6e7
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 13 deletions.
6 changes: 4 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,15 @@ ARG APCU_VERSION

WORKDIR /app

EXPOSE 80

# Install paquet requirements
RUN export PHP_CPPFLAGS="${PHP_CPPFLAGS} -std=c++11"; \
set -ex; \
# Install required system packages
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; \
Expand Down Expand Up @@ -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/*;
Expand Down Expand Up @@ -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
Expand Down
32 changes: 21 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
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
.PHONY: help start stop restart install uninstall reset clear-cache shell clear clean
.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
##---------------------------------------------------------------------------
Expand All @@ -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
Expand All @@ -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


##
Expand Down Expand Up @@ -81,17 +82,18 @@ 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
##---------------------------------------------------------------------------

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

Expand All @@ -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
Expand All @@ -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


##

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 1ebe6e7

Please sign in to comment.