-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
57 lines (46 loc) · 1.58 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
PIP = pip
.PHONY: verify
verify:
@echo "Executing command: dsw-mailer --version"
@dsw-mailer --version
.PHONY: local-deps
local-deps:
@echo "Installing local dependencies"
$(PIP) install ../dsw-config
$(PIP) install ../dsw-database
$(PIP) install ../dsw-command-queue
.PHONY: docker-image-name
docker-image-name:
@echo "mailer"
.PHONY: test
test:
@echo "No tests for this package"
.PHONE: lambda-package-requirements
lambda-package-requirements:
$(PIP) install --upgrade --target ./package -r $(FILE)
.PHONE: lambda-dependency
lambda-dependency:
$(MAKE) lambda-package-requirements FILE=../$(PKG)/requirements.txt
cp -R ../$(PKG)/dsw ./package
.PHONY: lambda-package
lambda-package:
$(MAKE) clean
# 1. Install and copy DSW packages
mkdir package
$(MAKE) lambda-package-requirements FILE=../../requirements.txt
$(MAKE) lambda-dependency PKG=dsw-command-queue
$(MAKE) lambda-dependency PKG=dsw-config
$(MAKE) lambda-dependency PKG=dsw-database
$(MAKE) lambda-dependency PKG=dsw-mailer
# 2. Fix postgres library for Lambda
$(PIP) install --upgrade --target ./package --platform manylinux2014_x86_64 --implementation cp --only-binary=:all: "psycopg[binary]"
cp package/psycopg_binary/_psycopg.cpython-311-x86_64-linux-gnu.so package/psycopg/_psycopg.so
cp package/psycopg_binary/_psycopg.cpython-311-x86_64-linux-gnu.so package/psycopg_binary/_psycopg.so
# 3. Package the ZIP and clean
cd package && zip -r ../mailer-lambda.zip .
rm -rf package
.PHONY: clean
clean:
find . -type d -name __pycache__ -exec rm -r {} \; >/dev/null || true
rm -rf package
rm mailer-lambda.zip || true