-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.layer
37 lines (32 loc) · 1.12 KB
/
Dockerfile.layer
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
# Use an official Python runtime as a parent image
ARG VERSION=3.11-arm64
FROM public.ecr.aws/lambda/python:${VERSION}
RUN --mount=type=cache,target=/var/cache/yum \
yum makecache && \
yum update && yum install zip -y
ENV HOME_DIR=/usr/local/layer
RUN mkdir -p ${HOME_DIR}/requirements
WORKDIR ${HOME_DIR}
#
# We only want to copy src/requirements.txt when it exists.
# There has to be at least one file in the src dir
#
COPY src/* requirements/
ARG PIP_PLATFORM=manylinux2014_aarch64
RUN if test -e requirements/requirements.txt; \
then \
pip install --target ${HOME_DIR}/python \
--platform ${PIP_PLATFORM} \
--implementation cp \
--only-binary=:all: \
--upgrade \
-r requirements/requirements.txt; \
fi
# Some dependencies bring boto3 in but the Lambda runtimes includes it already,
# so delete it from the Lambda zipfile
RUN rm -rf ${HOME_DIR}/python/boto*
RUN rm -rf ${HOME_DIR}/python/simplejson/tests*
# Remove the requirements dir
RUN rm -rf ${HOME_DIR}/requirements
COPY build/lib ./python/lib
RUN zip -rq layer.zip ./ -x "*.txt" -x "*_pycache_*"