forked from julesrb/Transcript42
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakefile
More file actions
49 lines (39 loc) · 1.17 KB
/
makefile
File metadata and controls
49 lines (39 loc) · 1.17 KB
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
48
49
VENV_DIR := .venv
PYTHON := $(VENV_DIR)/bin/python
PIP := $(VENV_DIR)/bin/pip
DOCKER_IMAGE := pdflatex-image
all: docker-image venv install run
docker-image:
@if [ -z "$$(docker images -q $(DOCKER_IMAGE))" ]; then \
echo "Building Docker image $(DOCKER_IMAGE)..."; \
docker build -t $(DOCKER_IMAGE) .; \
else \
echo "Docker image $(DOCKER_IMAGE) already exists."; \
fi
venv:
@test -d $(VENV_DIR) || python3 -m venv $(VENV_DIR)
install: venv
$(PIP) install --upgrade pip
$(PIP) install -r requirements.txt
run:
$(PYTHON) -m app.local
ssl-certif:
bash reverse_proxy.sh
serve: docker-image venv install
PYTHONPATH=app nohup $(VENV_DIR)/bin/gunicorn app.main:app \
--workers 1 \
--worker-class uvicorn.workers.UvicornWorker \
--bind 0.0.0.0:8000 \
--access-logfile - \
--access-logformat '%(t)s %(h)s %(r)s %(s)s %(b)s %(L)ss %(u)s %(q)s' \
--error-logfile - \
>> /logs.log 2>&1 &
clean:
rm -rf $(VENV_DIR)
find . -type d -name "__pycache__" -exec rm -rf {} +
@if docker images -q pdflatex-image > /dev/null; then \
echo "Removing Docker image pdflatex-image..."; \
docker rmi pdflatex-image; \
else \
echo "Docker image pdflatex-image not found."; \
fi