-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathMakefile
83 lines (61 loc) · 2.4 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
IMAGE ?= ghcr.io/furthemore/apis
TAG ?= $(shell git describe --tag --always)
all: help
define HELP
Commands:
make docker-login : Login to Github container repository
make build-base-docker-image : Build the base docker image
make build-docker-image : Make a local docker build of APIS
make push-docker-image : Push latest image to Github container repository
make tag-stage : Tag image for deployment to stage server
make tag-production : Tag image for deployment to production
make dev : Develop locally with Docker
make dev-setup : Sets up a venv for local development
make pre-commit-setup : Installs (or updates) pre-commit hooks
endef
export HELP
help:
@echo "$${HELP}"
docker-login:
@[ "${GITHUB_USER}" ] || ( echo ">> GITHUB_USER is not set, check out envrc.example"; exit 1 )
@[ "${GITHUB_CR_PAT}" ] || ( echo ">> GITHUB_CR_PAT is not set, check out envrc.example"; exit 1 )
@echo $(GITHUB_CR_PAT) | docker login ghcr.io -u $(GITHUB_USER) --password-stdin
build-base-docker-image:
# Build the base docker image for all external dependancies
docker build \
--file DockerfileBase \
--tag $(IMAGE):apis-base-$(shell git rev-parse --short HEAD) \
.
-docker push $(IMAGE):apis-base-$(shell git rev-parse --short HEAD)
sed -i 's/apis-base-.*$$/apis-base-$(shell git rev-parse --short HEAD)/' Dockerfile
build-docker-image:
# tag the current latest as previous, and replace it
-docker tag $(IMAGE):latest $(IMAGE):previous
# build and tag new container
docker build \
--file Dockerfile \
--build-arg SENTRY_RELEASE=$(TAG) \
--tag $(IMAGE):$(TAG) \
.
docker tag $(IMAGE):$(TAG) $(IMAGE):latest
tag-stage:
docker tag $(IMAGE):$(TAG) $(IMAGE):stage
docker push $(IMAGE):stage
tag-production:
docker tag $(IMAGE):$(TAG) $(IMAGE):production
docker push $(IMAGE):production
push-docker-image:
docker push $(IMAGE):$(TAG)
docker push $(IMAGE):latest
dev:
-docker-compose up -d
docker-compose exec app /bin/bash -c 'DJANGO_DEBUG=1 python /app/manage.py runserver_plus 0.0.0.0:8000'
dev-setup:
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
cp fm_eventmanager/settings.py.devel fm_eventmanager/settings.py
@echo "ACTION REQUIRED: Review fm_eventmanager/settings.py"
pre-commit-setup:
pip3 install pre-commit
pre-commit install