forked from hodgesmr/mastodon_digest
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
65 lines (54 loc) · 1.82 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
.PHONY: run help local dev
VERSION := $(shell git describe --abbrev=0 --tags)
BUILD_DATE := "$(shell date -u)"
VCS_REF := $(shell git log -1 --pretty=%h)
NAME := $(shell pwd | xargs basename)
VENDOR := "Matt Hodges"
ORG := hodgesmr
WORKDIR := "/opt/${NAME}"
# For running locally. We default to a general python3 but depending on the
# users environment they may need to specify which version to use. python3.9
# is the lowest tested with.
SYSTEM_PYTHON ?= python3
VENV_DIR := .venv
PYTHON_BIN := $(VENV_DIR)/bin/python
DOCKER_SCAN_SUGGEST=false
FLAGS ?=
print:
@echo BUILD_DATE=${BUILD_DATE}
@echo NAME=${NAME}
@echo ORG=${ORG}
@echo VCS_REF=${VCS_REF}
@echo VENDOR=${VENDOR}
@echo VERSION=${VERSION}
@echo WORKDIR=${WORKDIR}
@echo USER_OPTIONS=${USER_OPTIONS}
.EXPORT_ALL_VARIABLES:
build:
docker build -f Dockerfile \
-t ${ORG}/${NAME}:${VERSION} \
-t ${ORG}/${NAME}:latest . \
--build-arg VERSION=${VERSION} \
--build-arg BUILD_DATE=${BUILD_DATE} \
--build-arg VCS_REF=${VCS_REF} \
--build-arg NAME=${NAME} \
--build-arg VENDOR=${VENDOR} \
--build-arg ORG=${ORG} \
--build-arg WORKDIR=${WORKDIR}
.EXPORT_ALL_VARIABLES:
help:
docker run --env-file .env -it --rm -v "$(PWD)/render:${WORKDIR}/render" ${ORG}/${NAME} -h
.EXPORT_ALL_VARIABLES:
run:
docker run --env-file .env -it --rm -v "$(PWD)/render:${WORKDIR}/render" ${ORG}/${NAME} ${FLAGS}
python -m webbrowser -t "file://$(PWD)/render/index.html"
.EXPORT_ALL_VARIABLES:
dev:
@echo "Running with local development themes"
docker run --env-file .env -it --rm -v "$(PWD)/render:${WORKDIR}/render" -v "$(PWD)/templates:${WORKDIR}/templates" ${ORG}/${NAME} ${FLAGS}
python -m webbrowser -t "file://$(PWD)/render/index.html"
$(PYTHON_BIN):
$(SYSTEM_PYTHON) -m venv $(VENV_DIR)
$(PYTHON_BIN) -m pip install -r requirements.txt
local: $(PYTHON_BIN)
$(PYTHON_BIN) run.py ${FLAGS}