-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
87 lines (62 loc) · 2.35 KB
/
Copy pathMakefile
File metadata and controls
87 lines (62 loc) · 2.35 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# Makefile for Retouchly Docker operations
# Variables
IMAGE_NAME = retouchly
CONTAINER_NAME = retouchly-app
PORT = 3000
# Default target
.DEFAULT_GOAL := help
# Help target
help: ## Show this help message
@echo "Available commands:"
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
# Development
dev: ## Start development server
npm run dev
# Build
build: ## Build the Docker image
docker build -t $(IMAGE_NAME) .
build-no-cache: ## Build the Docker image without cache
docker build --no-cache -t $(IMAGE_NAME) .
# Run
run: ## Run the Docker container
docker run -d --name $(CONTAINER_NAME) -p $(PORT):$(PORT) --env-file .env.production.local $(IMAGE_NAME)
run-interactive: ## Run the Docker container interactively
docker run -it --rm -p $(PORT):$(PORT) --env-file .env.production.local $(IMAGE_NAME)
# Docker Compose
up: ## Start services with docker-compose
docker-compose up -d
up-build: ## Build and start services with docker-compose
docker-compose up --build -d
down: ## Stop services with docker-compose
docker-compose down
logs: ## View logs from docker-compose
docker-compose logs -f
# Container management
stop: ## Stop the running container
docker stop $(CONTAINER_NAME) || true
remove: ## Remove the container
docker rm $(CONTAINER_NAME) || true
restart: stop remove run ## Restart the container
# Image management
clean: ## Remove the Docker image
docker rmi $(IMAGE_NAME) || true
clean-all: ## Remove all unused Docker resources
docker system prune -a -f
# Health check
health: ## Check application health
curl -f http://localhost:$(PORT)/api/health || echo "Health check failed"
# Logs
container-logs: ## View container logs
docker logs -f $(CONTAINER_NAME)
# Shell access
shell: ## Access container shell
docker exec -it $(CONTAINER_NAME) /bin/sh
# Production deployment
deploy: build up health ## Build, deploy and check health
# Development workflow
dev-build: build run health ## Build, run and check health for development
# Cleanup workflow
cleanup: down remove clean ## Stop, remove container and clean image
# Full reset
reset: cleanup clean-all ## Complete cleanup and reset
.PHONY: help dev build build-no-cache run run-interactive up up-build down logs stop remove restart clean clean-all health container-logs shell deploy dev-build cleanup reset