Prompt
Maintain consistent Makefile patterns across all components to improve build reliability and developer experience in CI/CD pipelines.
Key practices to follow:
- Use
.PHONYtargets for all rules to prevent conflicts with actual files:.PHONY: build docker-build docker-push image - Standardize version tagging across components:
TAG ?= $(shell git describe --tags --always) - Create consistent build rule patterns across components:
docker-build: docker build -t ${IMG}:${TAG} -f Dockerfile . docker-push: docker push ${IMG}:${TAG} image: docker-build docker-push - Avoid changing directories in build commands when possible; use Docker’s build context parameter instead:
# Instead of: # cd .. && docker build -t ${IMG}:${TAG} -f Dockerfile . # Prefer: docker build -t ${IMG}:${TAG} -f Dockerfile .. - Remove unused or deprecated build rules to keep Makefiles maintainable.
These standardized patterns make it easier for developers to work across different components, improve CI/CD pipeline reliability, and reduce confusion when building and deploying components.