-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
61 lines (49 loc) · 2.87 KB
/
Makefile
File metadata and controls
61 lines (49 loc) · 2.87 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
50
51
52
53
54
55
56
57
58
59
60
61
PROJECT = tele_weather_bot
VIRTUAL_ENV = env
SOURCE_DIR = $(shell pwd)
install: virtual download_and_activate
build: clean_package build_package_tmp zip
virtual:
@echo "--> Setup and activate virtualenv"
if test ! -d "$(VIRTUAL_ENV)"; then \
pip3 install virtualenv; \
virtualenv -p python3 $(VIRTUAL_ENV); \
fi
@echo ""
download_and_activate:
@echo "-->Activating virtual environment"
if test -d "$(VIRTUAL_ENV)"; then \
. ./$(VIRTUAL_ENV)/bin/activate; \
pip3 install -r requirements.txt; \
fi
@echo "Now type 'source ./env/bin/activate' and start coding!"
clean_package:
rm -rf ./package/*
build_package_tmp:
mkdir -p ./package/tmp/
cp -a ./$(PROJECT) ./package/tmp/
cp main.py ./package/tmp/
cp requirements.txt ./package/tmp/
@test -f .env.yaml && cp .env.yaml ./package/tmp/ || echo yaml not present
copy_python:
if test -d $(VIRTUAL_ENV)/lib; then \
cp -a $(VIRTUAL_ENV)/lib/python3.6/site-packages/. ./package/tmp/; \
fi
if test -d $(VIRTUAL_ENV)/lib64; then \
cp -a $(VIRTUAL_ENV)/lib64/python3.6/site-packages/. ./package/tmp/; \
fi
remove_unused:
rm -rf ./package/tmp/wheel*
rm -rf ./package/tmp/easy-install*
rm -rf ./package/tmp/setuptools*
zip:
cd ./package/tmp && zip -r ../$(PROJECT).zip ./
deploy_gcloud_without_commit:
@test -f .env.yaml && gcloud functions deploy tele-weather-bot --entry-point lambda_handler --source $(SOURCE_DIR) --env-vars-file .env.yaml --runtime python37 --trigger-http || echo yaml not present, deploying without it;
@test -f .env.yaml || gcloud functions deploy tele-weather-bot --entry-point lambda_handler --source $(SOURCE_DIR) --runtime python37 --trigger-http;
deploy_gcloud_release:
@test -f .env.yaml && gcloud functions deploy tele-weather-bot --project vai-chover-bot --source https://source.developers.google.com/projects/vai-chover-bot/repos/WeatherBot/moveable-aliases/master/paths/ --env-vars-file .env.yaml --runtime python37 --trigger-http --entry-point lambda_handler || echo yaml not present, deploying without it;
@test -f .env.yaml || gcloud functions deploy tele-weather-bot --project vai-chover-bot --source https://source.developers.google.com/projects/vai-chover-bot/repos/WeatherBot/moveable-aliases/master/paths/ --runtime python37 --trigger-http --entry-point lambda_handler;
deploy_gcloud_testing:
@test -f .env.yaml && gcloud functions deploy tele-weather-bot --project vai-chover-bot --source https://source.developers.google.com/projects/vai-chover-bot/repos/WeatherBot/moveable-aliases/develop/paths/ --env-vars-file .env.yaml --runtime python37 --trigger-http --entry-point lambda_handler || echo yaml not present, deploying without it;
@test -f .env.yaml || gcloud functions deploy tele-weather-bot --project vai-chover-bot --source https://source.developers.google.com/projects/vai-chover-bot/repos/WeatherBot/moveable-aliases/develop/paths/ --runtime python37 --trigger-http --entry-point lambda_handler;