From 0fce758fbc6973e6f4f993ff32312238409b757a Mon Sep 17 00:00:00 2001 From: Chris Kankiewicz Date: Thu, 22 Apr 2021 22:38:04 -0700 Subject: [PATCH] Updated Makefile to run in the app container --- Dockerfile | 2 +- Makefile | 27 ++++++++++++++------------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/Dockerfile b/Dockerfile index 27c0f31..2866db5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,7 +15,7 @@ ENV XDG_CONFIG_HOME="/tmp/.config" RUN a2enmod rewrite -RUN apt-get update && apt-get install --assume-yes libmemcached-dev libzip-dev \ +RUN apt-get update && apt-get install --assume-yes libmemcached-dev libzip-dev tar zip \ && rm -rf /var/lib/apt/lists/* RUN docker-php-ext-install opcache zip \ diff --git a/Makefile b/Makefile index 07dfc39..bd72550 100644 --- a/Makefile +++ b/Makefile @@ -1,42 +1,43 @@ ARTIFACT_FILES=$$(paste --delimiters ' ' --serial artifacts.include) ARTIFACT_NAME="DirectoryLister-$$(git describe --tags --exact-match HEAD 2> /dev/null || git rev-parse --short HEAD)" +RUN := docker-compose run --rm app dev development: # Build application for development - @composer install --no-interaction - @npm install && npm run dev + @$(RUN) composer install --no-interaction + @$(RUN) npm install && npm run dev prod production: # Build application for production - @composer install --no-dev --no-interaction --prefer-dist --optimize-autoloader - @npm install --no-save && npm run production && npm prune --production + @$(RUN) composer install --no-dev --no-interaction --prefer-dist --optimize-autoloader + @$(RUN) npm install --no-save && npm run production && npm prune --production update upgrade: # Update application dependencies - @composer update && npm update && npm install && npm audit fix + @$(RUN) composer update && npm update && npm install && npm audit fix analyze: # Run coding standards and static analysis checks - @app/vendor/bin/php-cs-fixer fix --diff --dry-run && app/vendor/bin/psalm - @npx eslint app/resources/js/**/*.{js,vue} + @$(RUN) app/vendor/bin/php-cs-fixer fix --diff --dry-run && app/vendor/bin/psalm + @$(RUN) npx eslint app/resources/js/**/*.{js,vue} test: analyze # Run coding standards/static analysis checks and tests - @app/vendor/bin/phpunit --coverage-text + @$(RUN) app/vendor/bin/phpunit --coverage-text coverage: # Generate an HTML coverage report - @app/vendor/bin/phpunit --coverage-html .coverage + @docker-compose run --rm -e XDEBUG_MODE=coverage app app/vendor/bin/phpunit --coverage-html .coverage tunnel: # Expose the application via secure tunnel @ngrok http -host-header=rewrite http://directory-lister.local:80 clear-assets: # Clear the compiled assets - @rm app/assets/* -rfv + @$(RUN) rm app/assets/* -rfv clear-cache: # Clear the application cache - @rm app/cache/* -rfv + @$(RUN) rm app/cache/* -rfv tar: # Generate tarball - @tar --exclude-vcs --exclude=app/cache/* --exclude=app/resources \ + @$(RUN) tar --exclude-vcs --exclude=app/cache/* --exclude=app/resources \ --create --gzip --file artifacts/$(ARTIFACT_NAME).tar.gz $(ARTIFACT_FILES) zip: # Generate zip file - @zip --quiet --exclude "*.git*" "app/cache/**" "app/resources/*" \ + @$(RUN) zip --quiet --exclude "*.git*" "app/cache/**" "app/resources/*" \ --recurse-paths artifacts/$(ARTIFACT_NAME).zip $(ARTIFACT_FILES) artifacts: clear-assets production tar zip # Generate release artifacts