-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile.docker
More file actions
139 lines (117 loc) · 3.85 KB
/
Copy pathMakefile.docker
File metadata and controls
139 lines (117 loc) · 3.85 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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# Docker Makefile for Vantis Media Player
# Variables
IMAGE_NAME = vantismedia/vantis-player
VERSION ?= latest
REGISTRY ?= docker.io
FULL_IMAGE = $(REGISTRY)/$(IMAGE_NAME):$(VERSION)
# Colors
BLUE = \033[0;34m
GREEN = \033[0;32m
YELLOW = \033[1;33m
NC = \033[0m # No Color
.PHONY: help build push run clean test compose-up compose-down compose-logs
help: ## Show this help message
@echo "$(BLUE)Vantis Media Player - Docker Commands$(NC)"
@echo ""
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "$(GREEN)%-20s$(NC) %s\n", $$1, $$2}'
build: ## Build Docker image
@echo "$(BLUE)Building Docker image: $(FULL_IMAGE)$(NC)"
docker build -t $(FULL_IMAGE) .
@echo "$(GREEN)Build complete!$(NC)"
build-no-cache: ## Build Docker image without cache
@echo "$(BLUE)Building Docker image (no cache): $(FULL_IMAGE)$(NC)"
docker build --no-cache -t $(FULL_IMAGE) .
@echo "$(GREEN)Build complete!$(NC)"
push: ## Push Docker image to registry
@echo "$(BLUE)Pushing Docker image: $(FULL_IMAGE)$(NC)"
docker push $(FULL_IMAGE)
@echo "$(GREEN)Push complete!$(NC)"
tag-latest: ## Tag current image as latest
@echo "$(BLUE)Tagging image as latest$(NC)"
docker tag $(FULL_IMAGE) $(REGISTRY)/$(IMAGE_NAME):latest
@echo "$(GREEN)Tagged as latest$(NC)"
run: ## Run Docker container
@echo "$(BLUE)Running Vantis Media Player$(NC)"
docker run -it --rm \
--name vantis-player \
-v $(PWD)/media:/media:ro \
-v vantis-config:/config \
-v vantis-cache:/cache \
-v vantis-plugins:/plugins \
-p 8080:8080 \
--device /dev/dri:/dev/dri \
$(FULL_IMAGE) \
play /media
run-bash: ## Run Docker container with bash shell
@echo "$(BLUE)Running bash in container$(NC)"
docker run -it --rm \
--name vantis-player \
-v $(PWD)/media:/media:ro \
-v vantis-config:/config \
-v vantis-cache:/cache \
-v vantis-plugins:/plugins \
-p 8080:8080 \
--device /dev/dri:/dev/dri \
$(FULL_IMAGE) \
bash
clean: ## Remove Docker images and containers
@echo "$(YELLOW)Cleaning Docker resources$(NC)"
docker rmi $(FULL_IMAGE) || true
docker volume rm vantis-config vantis-cache vantis-plugins || true
@echo "$(GREEN)Clean complete!$(NC)"
test: ## Test Docker image
@echo "$(BLUE)Testing Docker image$(NC)"
docker run --rm \
-v $(PWD)/media:/media:ro \
$(FULL_IMAGE) \
--version
@echo "$(GREEN)Test complete!$(NC)"
compose-up: ## Start services with docker-compose
@echo "$(BLUE)Starting services with docker-compose$(NC)"
docker-compose up -d
@echo "$(GREEN)Services started!$(NC)"
compose-down: ## Stop services with docker-compose
@echo "$(BLUE)Stopping services$(NC)"
docker-compose down
@echo "$(GREEN)Services stopped!$(NC)"
compose-logs: ## View docker-compose logs
docker-compose logs -f
compose-restart: ## Restart services
@echo "$(BLUE)Restarting services$(NC)"
docker-compose restart
@echo "$(GREEN)Services restarted!$(NC)"
# Multi-platform builds
build-multi: ## Build for multiple platforms (requires buildx)
@echo "$(BLUE)Building for multiple platforms$(NC)"
docker buildx create --use --name vantis-builder || true
docker buildx build \
--platform linux/amd64,linux/arm64 \
-t $(FULL_IMAGE) \
--push \
.
@echo "$(GREEN)Multi-platform build complete!$(NC)"
# Development
dev-build: ## Quick development build
@echo "$(BLUE)Quick development build$(NC)"
docker build \
--build-arg CARGO_PROFILE=dev \
-t $(FULL_IMAGE)-dev \
.
dev-run: ## Run development container
@echo "$(BLUE)Running development container$(NC)"
docker run -it --rm \
--name vantis-player-dev \
-v $(PWD):/app \
-v $(PWD)/media:/media:ro \
-p 8080:8080 \
--device /dev/dri:/dev/dri \
$(FULL_IMAGE)-dev \
bash
# Release
release: build tag-latest push ## Build, tag as latest, and push
@echo "$(GREEN)Release complete!$(NC)"
# Version-specific builds
build-v1.0.0:
$(MAKE) build VERSION=1.0.0
push-v1.0.0:
$(MAKE) push VERSION=1.0.0