Skip to content

Commit

Permalink
handle docker-compose vs docker compose
Browse files Browse the repository at this point in the history
  • Loading branch information
wwbrannon committed Jul 16, 2024
1 parent e6bfe57 commit 0291b4e
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,25 +1,30 @@
SHELL := /bin/bash
DKC := $(shell command -v docker-compose 2> /dev/null || { command -v docker > /dev/null && echo 'docker compose'; })

ifeq ($(DKC),)
$(error Neither docker-compose nor docker compose found)
endif

.PHONY: up db-refresh sentiment-topic comments down build clean

up: db-refresh
export MODE=run && docker-compose up -d --remove-orphans streamlit
export MODE=run && $(DKC) up -d --remove-orphans streamlit

db-refresh: down build
export MODE=refresh && docker-compose run --remove-orphans --rm streamlit
export MODE=refresh && $(DKC) run --remove-orphans --rm streamlit

sentiment-topic: down build
docker-compose run --remove-orphans --rm sentiment-topic
$(DKC) run --remove-orphans --rm sentiment-topic

comments: down build
docker-compose run --remove-orphans --rm comments
$(DKC) run --remove-orphans --rm comments

down:
docker-compose down
docker-compose rm -fsv
$(DKC) down
$(DKC) rm -fsv

build:
docker-compose build
$(DKC) build

clean:
rm -rf build
Expand All @@ -33,4 +38,3 @@ clean:
find . -name '*~' -not -path '*/\.git/*' -exec rm -f {} \+
find . -name tags -not -path '*/\.git/*' -exec rm -f {} \+
find . -name tags.lock -not -path '*/\.git/*' -exec rm -f {} \+

0 comments on commit 0291b4e

Please sign in to comment.