-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
47 lines (37 loc) · 1.18 KB
/
Makefile
File metadata and controls
47 lines (37 loc) · 1.18 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
SHELL=/bin/bash
.DEFAULT_GOAL=setup
CURRENTDIR=$(shell dirname `pwd`)
ifneq (,$(wildcard ./.env))
include .env
export
endif
setup: requirements.txt
test -d .venv || python3 -m venv .venv
. .venv/bin/activate; pip install -r requirements.txt
@echo ""
@echo "Creating .env file, don't forget to change values according to your environment"
@test -f .env || cp .env.example .env
@sleep 2
@echo ""
@echo "Change .env values and execute make migrate to apply database changes."
run:
. .venv/bin/activate; FLASK_APP=src flask run --debug
add_dep: .venv
. .venv/bin/activate; pip install $(dep) && pip freeze | grep -v "pkg-resources" > requirements.txt
rm_dep: .venv
. .venv/bin/activate; pip uninstall $(dep) && pip freeze | grep -v "pkg-resources" > requirements.txt -y
# Build docker image to test locally
docker_build:
docker build \
--build-arg DATABASE_MIGRATION_URL=${DATABASE_MIGRATION_URL} \
--build-arg STORAGE_BUCKET=${STORAGE_BUCKET} \
--build-arg PROJECT=${PROJECT} \
-t <SERVICE> .
# Run docker image already built locally
docker_run:
docker run -p 5000:5000 \
<SERVICE>:latest
# Compile docker images and run locally
docker_compile:
make docker_build
make docker_run