-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
47 lines (34 loc) · 1.16 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
.PHONY: run
SITE_PACKAGES := $(shell pip show pip | grep '^Location' | cut -d' ' -f2-)
PROJECT_NAME := $(shell basename $(shell pwd))
# read and include .devcontainer/.env exporting all variables
ifneq (,$(wildcard .devcontainer/.env))
include .devcontainer/.env
export
ENV_FILE = .devcontainer/.env
endif
ifneq (,$(wildcard .env))
include .env
export
ENV_FILE = .env
endif
run: $(SITE_PACKAGES)
python3 app/app.py
reqs: $(SITE_PACKAGES)
$(SITE_PACKAGES): requirements.txt
pip install -r requirements.txt
touch requirements.txt
build-image:
docker build --target production -t ghcr.io/ilude/$(PROJECT_NAME):latest .
push-image: build-image
docker push ghcr.io/ilude/$(PROJECT_NAME)
stop-image:
-docker stop $(PROJECT_NAME)
run-image: build-image stop-image
docker run -d -it --rm --env-file $(ENV_FILE) --name $(PROJECT_NAME) ghcr.io/ilude/$(PROJECT_NAME):latest
bash-image: build-image
docker run -it --rm --env-file $(ENV_FILE) --name $(PROJECT_NAME) ghcr.io/ilude/$(PROJECT_NAME):latest bash
logs:
docker logs -f $(PROJECT_NAME)
ansible:
LC_ALL=C.UTF-8 ansible-playbook --inventory 127.0.0.1 --connection=local .devcontainer/ansible/setup-container.yml