forked from bandprotocol/data-source-runtime
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
21 lines (17 loc) · 1.19 KB
/
Copy pathMakefile
File metadata and controls
21 lines (17 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
.PHONY: lambda gcf
VERSION=2.0.2
CURRENT_DIR=$(shell pwd)
lambda:
cp $(CURRENT_DIR)/lambda/lambda_function.py $(CURRENT_DIR)/lambda/lambda_function.bak
RUNTIME_VERSION="lambda:$(VERSION)" envsubst < $(CURRENT_DIR)/lambda/lambda_function.bak > $(CURRENT_DIR)/lambda/lambda_function.py
cp $(CURRENT_DIR)/requirements.txt $(CURRENT_DIR)/lambda
docker run --rm -v $(CURRENT_DIR)/lambda:/pack python:3.8 ./pack/pack.sh
rm $(CURRENT_DIR)/lambda/requirements.txt
mv $(CURRENT_DIR)/lambda/lambda_function.bak $(CURRENT_DIR)/lambda/lambda_function.py
gcf:
mv $(CURRENT_DIR)/google-cloud-functions/main.py $(CURRENT_DIR)/google-cloud-functions/main.bak
RUNTIME_VERSION="google-cloud-function:$(VERSION)" envsubst < $(CURRENT_DIR)/google-cloud-functions/google_cloud_function.py > $(CURRENT_DIR)/google-cloud-functions/main.py
cat requirements.txt $(CURRENT_DIR)/google-cloud-functions/extra_requirements.txt >> $(CURRENT_DIR)/google-cloud-functions/requirements.txt
cd google-cloud-functions && zip google-cloud-function.zip main.py requirements.txt && cd ..
mv $(CURRENT_DIR)/google-cloud-functions/main.bak $(CURRENT_DIR)/google-cloud-functions/main.py
rm $(CURRENT_DIR)/google-cloud-functions/requirements.txt