Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing docker compose command error #57

Merged
merged 1 commit into from
Aug 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 16 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
# verifying which docker compose command is available
ifneq (, $(shell which docker-compose))
DOCKER_COMPOSE = docker-compose
else ifneq (, $(shell which docker))
DOCKER_COMPOSE = docker compose
else
$(error "Neither docker-compose nor docker compose is available")
endif

# loading and exporting all env vars from .env file automatically
ifneq (,$(wildcard ./.env))
include .env
Expand Down Expand Up @@ -34,25 +43,25 @@ local/run:
############################################

docker/install: generate-default-env-file
docker-compose build ${APP_NAME}
$(DOCKER_COMPOSE) build ${APP_NAME}

docker/up:
docker-compose up -d
$(DOCKER_COMPOSE) up -d

docker/down:
docker-compose down --remove-orphans
$(DOCKER_COMPOSE) down --remove-orphans

docker/test:
docker-compose run ${APP_NAME} poetry run pytest --cov-report=html --cov-report xml:coverage.xml --cov-report=term --cov .
$(DOCKER_COMPOSE) run ${APP_NAME} poetry run pytest --cov-report=html --cov-report xml:coverage.xml --cov-report=term --cov .

docker/lint:
docker-compose run ${APP_NAME} poetry run ruff check .
$(DOCKER_COMPOSE) run ${APP_NAME} poetry run ruff check .

docker/lint/fix:
docker-compose run ${APP_NAME} poetry run ruff . --fix
$(DOCKER_COMPOSE) run ${APP_NAME} poetry run ruff . --fix

docker/run:
docker-compose run ${APP_NAME} poetry run python ${MAIN_ENTRYPOINT}
$(DOCKER_COMPOSE) run ${APP_NAME} poetry run python ${MAIN_ENTRYPOINT}

####################################
# DOCKER IMAGE COMMANDS
Expand Down
Loading