-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
36 lines (27 loc) · 763 Bytes
/
Copy pathMakefile
File metadata and controls
36 lines (27 loc) · 763 Bytes
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
PYTHON ?= 3.12
PSYCOPG2 ?= 2.9.9
# x86_64 or arm64
ARCH ?= x86_64
NAME := psycopg2-$(PSYCOPG2)-python$(PYTHON)-$(ARCH)
IMAGE := $(NAME)-builder:latest
ZIP := $(NAME).zip
all: clean build
build:
docker build \
--build-arg PYTHON_VERSION=$(PYTHON) \
--build-arg PSYCOPG2_VERSION=$(PSYCOPG2) \
--build-arg ARCHITECTURE=$(ARCH) \
--tag $(IMAGE) .
docker run --rm -v $(CURDIR):/data $(IMAGE) \
zip -rT $(ZIP) /python
docker rmi $(IMAGE)
@echo
@echo 'Run the following command to publish the lambda layer:'
@echo
@echo 'aws lambda publish-layer-version \'
@echo ' --layer-name $(subst .,_,$(NAME)) \'
@echo ' --zip-file fileb://$(ZIP) \'
@echo ' --compatible-runtimes python$(PYTHON)'
clean:
-$(RM) $(ZIP)
.PHONY: all build clean