Untitled
env ?= $(shell basename `pwd`) composefiledev = docker-compose.dev.yml baseimage ?= gitlab-docker.mogic.com/docker/mogic-base-image:webapp-noble-php8.3 .PHONY: help .DEFAULT_GOAL := help help: @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' build-buildimage: ## build a new laravel production container docker pull $(baseimage) cd docker/web-build && docker build --build-arg BASEIMAGE=$(baseimage) --tag gitlab-docker.mogic.com/transdev/dfi/build:latest . docker push gitlab-docker.mogic.com/transdev/dfi/build:latest build-laravel-dev: ## build a new laravel dev container and push it to the registry docker pull $(baseimage) cd docker/laravel-dev && docker build --build-arg BASEIMAGE=$(baseimage) --tag gitlab-docker.mogic.com/transdev/dfi/dev:latest . docker push gitlab-docker.mogic.com/transdev/dfi/dev:latest start: create-network ## start previously stopped containers docker-compose -f $(composefiledev) up -d --no-recreate up: create-network ## pull and fresh containers docker-compose -f $(composefiledev) pull docker-compose -f $(composefiledev) up -d --force-recreate up-new: create-network stop clean ## cleanup all: fresh git, fresh data, fresh containers docker-compose -f $(composefiledev) pull docker-compose -f $(composefiledev) up -d --force-recreate docker-compose -f $(composefiledev) exec laravel-db /root/waitForMysql.sh 900 make laravel-init stop: ## stop containers docker-compose -f $(composefiledev) stop clean: ## delete container + data volumes docker-compose -f $(composefiledev) down --rmi all -v || true rm -rf laravel/vendor laravel/node_modules laravel-init: cd laravel && if [ ! -f .env ]; then cp .env.example .env; fi cd laravel && make build docker-compose -f $(composefiledev) exec laravel /bin/sh -c 'cd /var/www/laravel && php artisan key:generate' docker-compose -f $(composefiledev) exec laravel chown -R `id -u`:www-data /var/www/laravel/ docker-compose -f $(composefiledev) exec laravel chmod -R g+w /var/www/laravel/storage docker-compose -f $(composefiledev) exec laravel /bin/sh -c 'cd /var/www/laravel && php artisan storage:link' make laravel-migrate-fresh laravel-migrate: ## migrate database docker-compose -f $(composefiledev) exec laravel-db /root/waitForMysql.sh 900 docker-compose -f $(composefiledev) exec -T laravel sh -c 'cd /var/www/laravel/ && php artisan migrate' laravel-migrate-fresh: ## setup new database with seeder data docker-compose -f $(composefiledev) exec laravel-db /root/waitForMysql.sh 900 docker-compose -f $(composefiledev) exec -T laravel sh -c 'cd /var/www/laravel/ && php artisan migrate:fresh --seed' create-network: docker network create transdev-local-docker-network || true run-tests: docker-compose -f $(composefiledev) exec -T laravel sh -c 'cd /var/www/laravel/ && php artisan test'
Leave a Comment