Skip to content

Commit 8414e73

Browse files
authored
Merge pull request #38 from wmde/standardize-makefile
Improve Makefile
2 parents 79799c3 + 1778c68 commit 8414e73

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

Makefile

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
1-
# If the first argument is "composer"...
2-
ifeq (composer,$(firstword $(MAKECMDGOALS)))
3-
# use the rest as arguments for "composer"
4-
RUN_ARGS := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS))
5-
# ...and turn them into do-nothing targets
6-
$(eval $(RUN_ARGS):;@:)
7-
endif
81

9-
.PHONY: ci test phpunit cs stan covers composer
2+
DEFAULT_GOAL := ci
3+
current_user := $(shell id -u)
4+
current_group := $(shell id -g)
5+
BUILD_DIR := $(PWD)
6+
DOCKER_FLAGS := --interactive --tty
7+
DOCKER_IMAGE := registry.gitlab.com/fun-tech/fundraising-frontend-docker:latest
108

11-
DEFAULT_GOAL := ci
9+
install-php:
10+
docker run --rm $(DOCKER_FLAGS) --volume $(BUILD_DIR):/app -w /app --volume ~/.composer:/composer --user $(current_user):$(current_group) $(DOCKER_IMAGE) composer install $(COMPOSER_FLAGS)
11+
12+
update-php:
13+
docker run --rm $(DOCKER_FLAGS) --volume $(BUILD_DIR):/app -w /app --volume ~/.composer:/composer --user $(current_user):$(current_group) $(DOCKER_IMAGE) composer update $(COMPOSER_FLAGS)
1214

1315
ci: test cs
1416

@@ -29,6 +31,5 @@ fix-cs:
2931
docker compose run --rm app ./vendor/bin/phpcbf -p -s
3032

3133

32-
composer:
33-
docker run --rm --interactive --tty --volume $(shell pwd):/app -w /app\
34-
--volume ~/.composer:/composer --user $(shell id -u):$(shell id -g) composer composer --no-scripts $(filter-out $@,$(MAKECMDGOALS))
34+
.PHONY: ci test phpunit cs stan composer fix-cs
35+

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
services:
22
app:
3-
image: php:8.2-alpine
3+
image: "registry.gitlab.com/fun-tech/fundraising-frontend-docker:latest"
44
volumes:
55
- ./:/usr/src/app
66
working_dir: /usr/src/app

0 commit comments

Comments
 (0)