-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathMakefile
More file actions
68 lines (55 loc) · 2.37 KB
/
Makefile
File metadata and controls
68 lines (55 loc) · 2.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
.PHONY: build install generate build-site serve watch test lint fix-lint coverage bash help
IMAGE_NAME = mergephp-website
CONTAINER_NAME = mergephp-website-container
HOST_PORT = 8000
CONTAINER_PORT = 8000
ARGS ?=
# Default target
help:
@echo "Available commands:"
@echo " make build - Build the Docker image"
@echo " make install - Install Composer dependencies"
@echo " make generate - Generate a new meetup"
@echo " make build-site - Build the static site"
@echo " Example: make build-site ARGS='-- -vvv'"
@echo " make serve - Serve the site on localhost:$(HOST_PORT)"
@echo " make watch - Watch changes, build, and serve the site on localhost:$(HOST_PORT)"
@echo " Example: make watch ARGS='-vvv'"
@echo " make test - Run PHPUnit tests"
@echo " make lint - Check code style"
@echo " make fix-lint - Fix lint errors automatically"
@echo " make coverage - Generate code coverage report"
@echo " make bash - Open a bash shell in the container"
# Build the Docker image
build:
docker build -t $(IMAGE_NAME) .
# Install dependencies
install: build
docker run --rm -v $(PWD):/var/www/html $(IMAGE_NAME) composer install
# Generate a new meetup
generate: build
docker run --rm -it -v $(PWD):/var/www/html $(IMAGE_NAME) composer generate
# Build the static site
build-site: build
docker run --rm -v $(PWD):/var/www/html $(IMAGE_NAME) composer build $(ARGS)
# Serve the site
serve: build
docker run --rm -p $(HOST_PORT):$(CONTAINER_PORT) -v $(PWD):/var/www/html --name $(CONTAINER_NAME) $(IMAGE_NAME) php -S 0.0.0.0:$(CONTAINER_PORT) -t dist/
# Watch changes, build, and serve the site
watch: build
docker run --rm -it -p $(HOST_PORT):$(CONTAINER_PORT) -v $(PWD):/var/www/html --name $(CONTAINER_NAME) $(IMAGE_NAME) php console.php watch --host=0.0.0.0 $(ARGS)
# Run tests
test: build
docker run --rm -v $(PWD):/var/www/html $(IMAGE_NAME) composer test
# Run lint check
lint: build
docker run --rm -v $(PWD):/var/www/html $(IMAGE_NAME) composer lint
# Fix lint errors
fix-lint: build
docker run --rm -v $(PWD):/var/www/html $(IMAGE_NAME) composer fix-lint-errors
# Generate code coverage
coverage: build
docker run --rm -v $(PWD):/var/www/html $(IMAGE_NAME) composer coverage
# Open a bash shell in the container
bash: build
docker run --rm -it -v $(PWD):/var/www/html $(IMAGE_NAME) bash