-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
31 lines (24 loc) · 953 Bytes
/
Dockerfile
File metadata and controls
31 lines (24 loc) · 953 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
FROM public.ecr.aws/lambda/python:3.13
ENV NUMPY_VERSION="2.3.3"
ENV SHAPELY_VERSION="2.1.2"
ENV PANDAS_VERSION="2.3.3"
ENV GEOPANDAS_VERSION="0.14.4"
SHELL ["/bin/bash", "-c"]
WORKDIR /opt
RUN mkdir -p python
RUN dnf update -y && \
dnf install -y zip findutils
RUN pip install \
"numpy==${NUMPY_VERSION}" \
"shapely==${SHAPELY_VERSION}" \
"pandas==${PANDAS_VERSION}" \
"geopandas==${GEOPANDAS_VERSION}" \
-t python
# Precompile all python packages and remove .py files
RUN python -m compileall .
RUN find python/ -type f -name '*.pyc' | while read f; do n=$(echo $f | sed 's/__pycache__\///' | sed 's/.cpython-313//'); cp $f $n; done;
RUN find python/ -type d -a -name '__pycache__' -print0 | xargs -0 rm -rf
RUN find python/ -type f -a -name '*.py' -print0 | xargs -0 rm -f
# Compress all source codes except files listed in .lambdaignore
COPY .lambdaignore .
RUN cat .lambdaignore | xargs zip -9qyr layer.zip python -x