This repository was archived by the owner on Oct 21, 2019. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +33
-5
lines changed Expand file tree Collapse file tree 3 files changed +33
-5
lines changed Original file line number Diff line number Diff line change 1+ * .zip
Original file line number Diff line number Diff line change 77RUN yum makecache fast
88RUN yum install -y automake16 libpng-devel nasm
99
10- ENV PREFIX /var/task
10+ # labda runtime: /var/task
11+ # labda layer: /opt
12+ ARG prefix=/var/task
13+ ENV PREFIX=${prefix}
1114
1215# versions of packages
1316ENV \
Original file line number Diff line number Diff line change 2727 docker run ${BUILD} bash -c " python --version | grep '${PY_VERSION} '"
2828
2929push :
30- # docker tag ${IMAGE} ${BUILD}
3130 docker push ${DOCKER_USERNAME} /${BUILD}
3231
33- clean :
34- docker stop amazonlinux
35- docker rm amazonlinux
32+ container-clean :
33+ docker stop amazonlinux > /dev/null 2>&1 || true
34+ docker rm amazonlinux > /dev/null 2>&1 || true
35+
36+ # ---
37+ # lambda layer build and package using /opt
38+
39+ LAYER_BUILD = ${BUILD}-layer
40+ LAYER_PACKAGE := amazonlinux-${TAG}-layer.zip
41+
42+ lambda-layer-build :
43+ docker build -f Dockerfile -t ${LAYER_BUILD} --build-arg prefix=/opt .
44+
45+ lambda-layer-shell : lambda-layer-build container-clean
46+ docker run --name amazonlinux --volume $(shell pwd) /:/data --rm -it ${LAYER_BUILD} /bin/bash
47+
48+ lambda-layer-package : lambda-layer-build container-clean
49+ docker run --name amazonlinux -itd ${LAYER_BUILD} /bin/bash
50+ docker exec -it amazonlinux bash -c ' mkdir -p $${PREFIX}/python/lib/python${PY_VERSION}/site-packages'
51+ docker exec -it amazonlinux bash -c ' rsync -a /var/lang/lib/python${PY_VERSION}/site-packages/ $${PREFIX}/python/lib/python${PY_VERSION}/site-packages/'
52+ docker exec -it amazonlinux bash -c ' cd $${PREFIX} && zip -r9 --symlinks /tmp/package.zip python'
53+ docker exec -it amazonlinux bash -c ' cd $${PREFIX} && zip -r9 --symlinks /tmp/package.zip lib/*.so*'
54+ docker exec -it amazonlinux bash -c ' cd $${PREFIX} && zip -r9 --symlinks /tmp/package.zip lib64/*.so*'
55+ docker exec -it amazonlinux bash -c ' cd $${PREFIX} && zip -r9 --symlinks /tmp/package.zip bin'
56+ docker exec -it amazonlinux bash -c ' cd $${PREFIX} && zip -r9 /tmp/package.zip share'
57+ docker cp amazonlinux:/tmp/package.zip ${LAYER_PACKAGE}
58+ docker stop amazonlinux && docker rm amazonlinux
59+
You can’t perform that action at this time.
0 commit comments