Last active
December 22, 2024 23:16
-
-
Save Raimo33/d5808e891a3361c25f6bb507642d2a04 to your computer and use it in GitHub Desktop.
Docker Compose Makefile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# **************************************************************************** # | |
# # | |
# ::: :::::::: # | |
# Makefile :+: :+: :+: # | |
# +:+ +:+ +:+ # | |
# By: craimond <[email protected]> +#+ +:+ +#+ # | |
# +#+#+#+#+#+ +#+ # | |
# Created: 2024/08/06 01:09:08 by craimond #+# #+# # | |
# Updated: 2024/09/15 14:24:42 by craimond ### ########.fr # | |
# # | |
# **************************************************************************** # | |
export USERNAME := $(shell whoami) | |
DOCKER_COMPOSE_PATH = srcs/docker-compose.yml | |
DEPS = docker-compose | |
all: deps init build down up perms | |
deps: | |
sudo apt-get install -y $(DEPS) | |
sudo usermod -aG docker $(USERNAME) | |
init: | |
up: | |
docker-compose -f $(DOCKER_COMPOSE_PATH) up --detach | |
down: | |
docker-compose -f $(DOCKER_COMPOSE_PATH) down | |
down-v: | |
docker-compose -f $(DOCKER_COMPOSE_PATH) down --volumes | |
build: | |
docker-compose -f $(DOCKER_COMPOSE_PATH) build | |
restart: | |
docker-compose -f $(DOCKER_COMPOSE_PATH) restart | |
logs: | |
docker-compose -f $(DOCKER_COMPOSE_PATH) logs | |
clean: down | |
sudo docker system prune --force --all | |
fclean: .confirm down-v | |
sudo docker system prune --force --all --volumes | |
.confirm: | |
echo "Are you sure you want to continue? (y/n)"; \ | |
read RESPONSE; \ | |
if [ "$$RESPONSE" != "y" ] && [ "$$RESPONSE" != "Y" ]; then exit 1; fi | |
re: fclean all | |
.PHONY: | |
.SILENT: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment