Skip to content

Instantly share code, notes, and snippets.

@apzentral
Last active February 4, 2022 23:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save apzentral/f752b7fa3e2177671574665031fa10b7 to your computer and use it in GitHub Desktop.
Save apzentral/f752b7fa3e2177671574665031fa10b7 to your computer and use it in GitHub Desktop.
Makefile for docker-compose
## docker-compose : Makefile
ENV_FILE_PATH = ./docker/.env
DOCKER_COMPOSE_FILE_PATH = ./docker/docker-compose.yml
start:
docker-compose --env-file $(ENV_FILE_PATH) -f $(DOCKER_COMPOSE_FILE_PATH) build && docker-compose --env-file $(ENV_FILE_PATH) -f $(DOCKER_COMPOSE_FILE_PATH) up -d
logs:
docker-compose --env-file $(ENV_FILE_PATH) -f $(DOCKER_COMPOSE_FILE_PATH) logs -f --tail 20
start-logs:
docker-compose --env-file $(ENV_FILE_PATH) -f $(DOCKER_COMPOSE_FILE_PATH) build && docker-compose --env-file $(ENV_FILE_PATH) -f $(DOCKER_COMPOSE_FILE_PATH) up
start-skip-build:
docker-compose --env-file $(ENV_FILE_PATH) -f $(DOCKER_COMPOSE_FILE_PATH) up -d
stop:
docker-compose --env-file $(ENV_FILE_PATH) -f $(DOCKER_COMPOSE_FILE_PATH) stop
status:
docker-compose --env-file $(ENV_FILE_PATH) -f $(DOCKER_COMPOSE_FILE_PATH) ps
build:
docker-compose --env-file $(ENV_FILE_PATH) -f $(DOCKER_COMPOSE_FILE_PATH) build
down:
docker-compose --env-file $(ENV_FILE_PATH) -f $(DOCKER_COMPOSE_FILE_PATH) down
restart:
docker-compose --env-file $(ENV_FILE_PATH) -f $(DOCKER_COMPOSE_FILE_PATH) restart
clean:
docker-compose --env-file $(ENV_FILE_PATH) -f $(DOCKER_COMPOSE_FILE_PATH) down && docker system prune -f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment