-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
61 lines (48 loc) · 1.98 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
include config.mk
.DEFAULT_GOAL := build
LOG_DATA_PATH=docker/logs
# FIXME: mail api currently unused until we need email from the app
MAIL_API_KEY_PATH=secrets/mail_api_key
BUILD_CONSTANTS_PATH=app/store/modules/_constants.js
BUILD_ID=$(shell git describe --tags --abbrev=1)
CITATION_TXT_FILE=_citation.txt
CITATION_BIB_FILE=_citation.bib
$(CITATION_TXT_FILE): CITATION.cff
docker run --rm -v $(PWD):/app citationcff/cffconvert -f apalike -o $(CITATION_TXT_FILE)
docker run --rm -v $(PWD):/app citationcff/cffconvert -f bibtex -o $(CITATION_BIB_FILE)
.PHONY: $(BUILD_CONSTANTS_PATH)
$(BUILD_CONSTANTS_PATH): app/store/modules/_constants.js.template config.mk $(CITATION_TXT_FILE)
echo 'export const CITATION_TXT = "$(shell cat ${CITATION_TXT_FILE})";' > $(BUILD_CONSTANTS_PATH)
echo 'export const CITATION_BIB = "$(shell cat ${CITATION_BIB_FILE})";' >> $(BUILD_CONSTANTS_PATH)
envsubst < app/store/modules/_constants.js.template >> $(BUILD_CONSTANTS_PATH)
echo 'export const BUILD_ID = "${BUILD_ID}";' >> $(BUILD_CONSTANTS_PATH)
.PHONY: build | secrets
build: docker-compose.yml $(BUILD_CONSTANTS_PATH)
docker compose build --pull
.PHONY: secrets
secrets: $(SECRETS)
mkdir -p secrets
.PHONY: clean
clean:
rm -rf secrets
rm config.mk $(BUILD_CONSTANTS_PATH) $(CITATION_TXT_FILE)
config.mk:
@echo 'WARNING: no config.mk found, using default template dev environment'
SKOPE_DEPLOY_ENVIRONMENT=dev envsubst < config.mk.template > config.mk
$(LOG_DATA_PATH):
mkdir -p $(LOG_DATA_PATH)
$(MAIL_API_KEY_PATH): | secrets
touch "$(MAIL_API_KEY_PATH)"
DEPLOY_ENVIRONMENT ?= dev
docker-compose.yml: base.yml config.mk $(DEPLOY_ENVIRONMENT).yml $(LOG_DATA_PATH) $(BUILD_CONSTANTS_PATH)
@echo "DEPLOY_ENVIRONMENT: $(DEPLOY_ENVIRONMENT)"
docker compose -f base.yml -f $(DEPLOY_ENVIRONMENT).yml config > docker-compose.yml
.PHONY: buildprod
buildprod: build
docker compose run --rm web yarn build
.PHONY: lint
lint: build
docker compose run --rm web yarn lintfix
.PHONY: deploy
deploy: build
docker compose up -d