This repository was archived by the owner on Oct 8, 2021. It is now read-only.
forked from gkrizek/bash-lambda-layer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
65 lines (54 loc) · 1.7 KB
/
Makefile
File metadata and controls
65 lines (54 loc) · 1.7 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
62
63
64
65
SHELL = /usr/bin/env bash -xe
AWSCLI_VERSION := 2.0.30
JQ_VERSION := 1.6
PWD := $(shell pwd)
build_on_docker: yumda archives/awscli-exe-linux-x86_64-$(AWSCLI_VERSION).zip
docker build -t bash-lambda-layer-builder docker/builder
docker run -v $(PWD):/root/bash-lambda-layer -v $(PWD)/bin:/opt/bin \
--workdir="/root/bash-lambda-layer" \
bash-lambda-layer-builder \
make build
build: awscli bin/jq
@rm -rf export
@mkdir export
@zip -yr export/layer.zip bootstrap bin lib share
@zip -yr export/bash-lambda-layer.zip export/layer.zip publish.sh publish-only.sh README.publish.md
yumda:
docker run --rm -v $(PWD):/lambda/opt lambci/yumda:2 yum install -y zip-3.0 unzip-6.0
publish:
@$(PWD)/publish.sh
publish-staging:
@$(PWD)/publish-staging.sh
publish-only:
@$(PWD)/publish-only.sh
archives/awscli-exe-linux-x86_64-$(AWSCLI_VERSION).zip:
aws s3 cp s3://kayac-bash-lambda-layer/archives/awscli-exe-linux-x86_64-$(AWSCLI_VERSION).zip archives/
# https://docs.aws.amazon.com/lambda/latest/dg/runtimes-walkthrough.html
# Custom runtimes are deployed in the /opt/ directory.
# AWS CLI v2 install path is /opt/bin/awscli
awscli: archives/awscli-exe-linux-x86_64-$(AWSCLI_VERSION).zip
unzip -q archives/awscli-exe-linux-x86_64-$(AWSCLI_VERSION).zip -d /tmp
cd /tmp \
&& rm -rf ./aws/dist/awscli/examples \
&& ./aws/install -i /opt/bin/awscli -b /opt/bin --update \
&& rm -rf aws
bin/jq:
cd bin/ \
&& curl -o jq -sL https://github.com/stedolan/jq/releases/download/jq-$(JQ_VERSION)/jq-linux64 \
&& chmod +x jq
clean:
rm -rf bin/
mkdir bin
touch bin/.gitkeep
rm -rf share/
mkdir share
touch share/.gitkeep
rm -rf lib/
mkdir lib
touch lib/.gitkeep
.PHONY: \
build
publish
publish-staging
awscli
yumda