Skip to content

Instantly share code, notes, and snippets.

@ucyo
Created August 29, 2022 08:46
Show Gist options
  • Select an option

  • Save ucyo/3cb25af672db261132fcc0dca5ebb427 to your computer and use it in GitHub Desktop.

Select an option

Save ucyo/3cb25af672db261132fcc0dca5ebb427 to your computer and use it in GitHub Desktop.
Sane Makefile options
-include .env # optional environment file `.env` (mandatory file w/o the `-`)
MODE ?= development # Dynamic environment variable defaulting to `development` and can be set via `make up MODE=production`
export
build:
@echo "===================================================================="
@echo "Building services"
@echo "===================================================================="
@docker compose build
up:
@echo "===================================================================="
@echo "Run $(MODE) system"
@echo "===================================================================="
@docker compose up -d
clean:
@echo "===================================================================="
@echo "Clean up docker compose with orphans"
@echo "===================================================================="
@docker compose down --remove-orphans
deploy:
@echo "===================================================================="
@echo "Start production node: '$(MODE)'"
@echo "===================================================================="
ifneq $(MODE) production
$(error MODE must be 'production' it is '$(MODE)')
else
@docker compose -f docker-compose.yaml -f docker-compose.prod.yaml up -d
endif
.PHONY: build clean deploy up
# check:
# @while inotifywait -q -e modify -e create -e delete -e move --recursive /home/python/ ; do \
# clear; \
# echo "===================================================================="; \
# echo "Check & correct format via black"; \
# echo "===================================================================="; \
# black --check /home/python/imktk; \
# echo ""; \
# echo ""; \
# echo "===================================================================="; \
# echo "Formatting and linting"; \
# echo "===================================================================="; \
# flake8 /home/python/imktk; \
# done
#
# watch: container
# @echo "===================================================================="
# @echo "Starting watch environment in docker container"
# @echo "===================================================================="
# @docker run --pull never --workdir /home/python --rm -it -v $(shell pwd)/imktk:/home/python/imktk imktk/imktk make check
#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment