aletrn commited on
Commit
c6215d1
·
1 Parent(s): a354309

[ci] switch base docker image to python:3.11-slim-bookworm, use opencv-python-headless

Browse files
dockerfiles/dockerfile-lambda-fastsam-api CHANGED
@@ -19,15 +19,16 @@ RUN ls -l ${LAMBDA_TASK_ROOT}
19
  RUN ls -ld ${LAMBDA_TASK_ROOT}
20
  RUN ls -l ${LAMBDA_TASK_ROOT}/models
21
  RUN python -c "import sys; print(sys.path)"
22
- RUN python -c "import osgeo"
23
  RUN python -c "import cv2"
24
- # RUN python -c "import geopandas"
25
- # RUN python -c "import onnxruntime"
26
- # RUN python -c "import rasterio"
27
  RUN python -c "import awslambdaric"
28
  RUN python -m pip list
29
  RUN python -m pip freeze
30
  RUN df -h
 
 
31
 
32
- ENTRYPOINT ["/lambda-entrypoint.sh"]
33
  CMD [ "src.app.lambda_handler" ]
 
19
  RUN ls -ld ${LAMBDA_TASK_ROOT}
20
  RUN ls -l ${LAMBDA_TASK_ROOT}/models
21
  RUN python -c "import sys; print(sys.path)"
 
22
  RUN python -c "import cv2"
23
+ RUN python -c "import geopandas"
24
+ RUN python -c "import onnxruntime"
25
+ RUN python -c "import rasterio"
26
  RUN python -c "import awslambdaric"
27
  RUN python -m pip list
28
  RUN python -m pip freeze
29
  RUN df -h
30
+ RUN ls -l /lambda-entrypoint.sh
31
+ RUN ls -l ${LAMBDA_TASK_ROOT}/src/
32
 
33
+ # ENTRYPOINT ["/lambda-entrypoint.sh"]
34
  CMD [ "src.app.lambda_handler" ]
dockerfiles/dockerfile-lambda-gdal-runner CHANGED
@@ -1,4 +1,4 @@
1
- FROM ghcr.io/osgeo/gdal:ubuntu-small-3.7.2
2
 
3
  # Include global arg in this stage of the build
4
  ARG LAMBDA_TASK_ROOT="/var/task"
@@ -9,13 +9,15 @@ RUN echo "ENV RIE: $RIE ..."
9
 
10
  # Set working directory to function root directory
11
  WORKDIR ${LAMBDA_TASK_ROOT}
12
- COPY requirements_dev.txt ${LAMBDA_TASK_ROOT}/requirements.txt
 
13
 
14
  # avoid segment-geospatial exception caused by missing libGL.so.1 library
15
  RUN apt update && apt install -y libgl1 curl python3-pip
16
  RUN ls -ld /usr/lib/*linux-gnu/libGL.so* || echo "libGL.so* not found..."
17
  RUN which python
18
  RUN python --version
 
19
  RUN python -m pip install -r ${LAMBDA_TASK_ROOT}/requirements.txt --target ${LAMBDA_TASK_ROOT}
20
  RUN python -c "import sys;print(sys.path)"
21
  # RUN python -m pip install pillow awslambdaric aws-lambda-powertools httpx jmespath --target ${LAMBDA_TASK_ROOT}
 
1
+ FROM python:3.11-slim-bookworm
2
 
3
  # Include global arg in this stage of the build
4
  ARG LAMBDA_TASK_ROOT="/var/task"
 
9
 
10
  # Set working directory to function root directory
11
  WORKDIR ${LAMBDA_TASK_ROOT}
12
+ COPY requirements_pip.txt ${LAMBDA_TASK_ROOT}/requirements_pip.txt
13
+ COPY requirements.txt ${LAMBDA_TASK_ROOT}/requirements.txt
14
 
15
  # avoid segment-geospatial exception caused by missing libGL.so.1 library
16
  RUN apt update && apt install -y libgl1 curl python3-pip
17
  RUN ls -ld /usr/lib/*linux-gnu/libGL.so* || echo "libGL.so* not found..."
18
  RUN which python
19
  RUN python --version
20
+ RUN python -m pip install -r ${LAMBDA_TASK_ROOT}/requirements_pip.txt --upgrade --target ${LAMBDA_TASK_ROOT}
21
  RUN python -m pip install -r ${LAMBDA_TASK_ROOT}/requirements.txt --target ${LAMBDA_TASK_ROOT}
22
  RUN python -c "import sys;print(sys.path)"
23
  # RUN python -m pip install pillow awslambdaric aws-lambda-powertools httpx jmespath --target ${LAMBDA_TASK_ROOT}
requirements.txt CHANGED
@@ -5,7 +5,7 @@ geopandas
5
  jmespath
6
  numpy
7
  onnxruntime
8
- opencv-python
9
  pillow
10
  pydantic>=2.0.3
11
  python-dotenv
 
5
  jmespath
6
  numpy
7
  onnxruntime
8
+ opencv-python-headless
9
  pillow
10
  pydantic>=2.0.3
11
  python-dotenv
scripts/lambda-entrypoint.sh CHANGED
@@ -1,7 +1,7 @@
1
  #!/bin/sh
2
 
3
  if [ -z "${AWS_LAMBDA_RUNTIME_API}" ]; then
4
- exec /usr/local/bin/aws-lambda-rie /usr/bin/python -m awslambdaric "$@"
5
  else
6
- exec /usr/bin/python -m awslambdaric "$@"
7
  fi
 
1
  #!/bin/sh
2
 
3
  if [ -z "${AWS_LAMBDA_RUNTIME_API}" ]; then
4
+ exec /usr/local/bin/aws-lambda-rie /usr/local/bin/python -m awslambdaric "$@"
5
  else
6
+ exec /usr/local/bin/python -m awslambdaric "$@"
7
  fi