forked from aws-powertools/powertools-lambda-layer-cdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
28 lines (22 loc) · 845 Bytes
/
Dockerfile
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
FROM public.ecr.aws/lambda/python:3.8
ARG PACKAGE_SUFFIX=''
USER root
WORKDIR /tmp
# PACKAGE_SUFFIX = '[all]==2.0.0'
# PACKAGE_SUFFIX = '[all]'
# PACKAGE_SUFFIX = '=='2.0.0'
# PACKAGE_SUFFIX = ''
RUN yum update -y && yum install -y zip unzip wget tar gzip binutils
RUN pip install -t /asset/python aws-lambda-powertools$PACKAGE_SUFFIX
# Removing nonessential files
RUN cd /asset && \
# remove boto3 and botocore (already available in Lambda Runtime)
rm -rf python/boto* && \
# remove boto3 dependencies
rm -rf python/s3transfer* python/*dateutil* python/urllib3* python/six* && \
# remove debugging symbols
find python -name '*.so' -type f -exec strip "{}" \; && \
# remove tests
find python -wholename "*/tests/*" -type f -delete && \
# remove python bytecode
find python -regex '^.*\(__pycache__\|\.py[co]\)$' -delete