-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
59 lines (49 loc) · 2.11 KB
/
Makefile
File metadata and controls
59 lines (49 loc) · 2.11 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
# Variables
DOCKER_COMPOSE = docker-compose
DOCKER_COMPOSE_FILE = docker-compose.yml
ENV = ./dev/.env
# Targets
.PHONY: up down build rebuild logs clean compile generate-api-secret help
# Start all services in detached mode
up:
@$(DOCKER_COMPOSE) --env-file $(ENV) --project-name private-network -f $(DOCKER_COMPOSE_FILE) up --build -d
@echo "Docker services are now running."
@make logs
# Stop all running services
down:
@$(DOCKER_COMPOSE) --project-name private-network -f $(DOCKER_COMPOSE_FILE) down
@echo "Docker services stopped."
# Build Docker Compose services without cache
build:
@$(DOCKER_COMPOSE) --env-file $(ENV) --project-name private-network -f $(DOCKER_COMPOSE_FILE) build --no-cache
@echo "Docker images have been built."
# Rebuild and restart services
rebuild:
@$(DOCKER_COMPOSE) --env-file $(ENV) --project-name private-network -f $(DOCKER_COMPOSE_FILE) up --build -d
@echo "Docker services have been rebuilt and started."
# Show logs from Docker Compose services
logs:
@docker logs -f wireguard-api
# Clean up dangling images, stopped containers, and unused networks
clean:
@$(DOCKER_COMPOSE) --project-name private-network -f $(DOCKER_COMPOSE_FILE) down --rmi all --volumes --remove-orphans
@echo "Cleaned up unused Docker resources."
# Show all available commands
help:
@echo "Makefile for Docker Compose Utilities"
@echo
@echo "Commands:"
@echo " make up - Start all services in detached mode"
@echo " make down - Stop all running services"
@echo " make build - Build services without using cache"
@echo " make rebuild - Rebuild and restart all services"
@echo " make logs - View logs in real-time"
@echo " make clean - Remove unused volumes, images, and networks"
@echo " make compile - Compile the WireGuard API"
@echo " make generate-api-secret - Generate a new API secret"
@echo " make help - Show this help message"
compile:
@docker build -t wireguard-api-compiler -f DockerfileBuild .
@docker run --rm -v $(PWD)/.temp:/output wireguard-api-compiler
generate-api-secret:
@docker exec -it wireguard-api api-key-generator --exp 87660 --client "Software Place CO"