Inception/Makefile
2025-05-19 13:24:26 +02:00

68 lines
2.1 KiB
Makefile

# **************************************************************************** #
# #
# :::::::: #
# Makefile :+: :+: #
# +:+ #
# By: whaffman <whaffman@student.codam.nl> +#+ #
# +#+ #
# Created: 2025/05/12 15:33:56 by whaffman #+# #+# #
# Updated: 2025/05/19 13:22:28 by whaffman ######## odam.nl #
# #
# **************************************************************************** #
DOCKER_COMPOSE = docker compose
DOCKER_COMPOSE_FILE = ./srcs/docker-compose.yml
DOCKER_ENV_FILE = ./srcs/.env
DC = $(DOCKER_COMPOSE) -f $(DOCKER_COMPOSE_FILE) --env-file $(DOCKER_ENV_FILE)
.PHONY: all build up down remove
all: build up
build:
@echo "$(gub)Building Docker containers...$(reset)"
$(DC) build
up:
@echo "$(gub)Starting Docker containers...$(reset)"
$(DC) up -d --build
down:
@echo "$(gub)Stopping Docker containers...$(reset)"
$(DC) down
clean:
@echo "$(gub)Cleaning up Docker containers...$(reset)"
$(DC) down --rmi local --volumes --remove-orphans
logs:
@echo "$(gub)Displaying logs...$(reset)"
@$(DC) logs
ps:
@echo "$(gub)Displaying running containers...$(reset)"
@$(DC) ps
@echo "$(gub)Displaying networks...$(reset)"
@docker network ls
@echo "$(gub)Displaying volumes...$(reset)"
@docker volume ls
@echo "$(gub)Displaying images...$(reset)"
@docker images
@echo "$(gub)Displaying all containers...$(reset)"
@docker ps -a
remove:
@echo "$(gub)Removing Docker containers...$(reset)"
@$(DC) rm -f
@$(DC) volume rm -f
@$(DC) network rm -f
# Colors
green:=$(shell tput setaf 2)
bold:=$(shell tput bold)
uncerline:=$(shell tput smul)
gub:=$(green)$(underline)$(bold)
reset:=$(shell tput sgr0)