@@ -12,10 +12,17 @@ ARG RUNTIME_VERSION
12
12
RUN apt-get update && apt-get install -y software-properties-common
13
13
RUN add-apt-repository ppa:deadsnakes/ppa
14
14
RUN apt-get update && \
15
- apt-get install -y curl python${RUNTIME_VERSION}
16
-
17
- RUN ln -s /usr/bin/python${RUNTIME_VERSION} /usr/local/bin/python3
18
-
15
+ apt-get install -y \
16
+ curl \
17
+ python${RUNTIME_VERSION} \
18
+ python3-pip \
19
+ python3-virtualenv
20
+
21
+ # python3xx-distutils is needed for python < 3.12
22
+ RUN if [ $(echo ${RUNTIME_VERSION} | cut -d '.' -f 2) -lt 12 ]; then \
23
+ apt-get install -y python${RUNTIME_VERSION}-distutils; \
24
+ fi
25
+ RUN virtualenv --python /usr/bin/python${RUNTIME_VERSION} --no-setuptools /home/venv
19
26
20
27
21
28
@@ -25,8 +32,7 @@ FROM python-image AS python-ubuntu-builder
25
32
ARG RUNTIME_VERSION
26
33
27
34
# Install aws-lambda-cpp build dependencies
28
- RUN apt-get update && \
29
- apt-get install -y \
35
+ RUN apt-get install -y \
30
36
g++ \
31
37
gcc \
32
38
tar \
@@ -39,16 +45,6 @@ RUN apt-get update && \
39
45
libcurl4-openssl-dev \
40
46
python${RUNTIME_VERSION}-dev
41
47
42
- RUN if [ $(echo "${RUNTIME_VERSION}" | cut -d '.' -f 2) -ge 12 ]; then \
43
- apt-get install -y python3-setuptools python3-pip python${RUNTIME_VERSION}-venv && \
44
- python3 -m venv /home/venv; \
45
- else \
46
- curl "https://bootstrap.pypa.io/get-pip.py" -o "get-pip.py" && \
47
- python${RUNTIME_VERSION} get-pip.py && \
48
- pip3 install virtualenv && \
49
- virtualenv /home/venv; \
50
- fi
51
-
52
48
# Include global args in this stage of the build
53
49
ARG RIC_BUILD_DIR="/home/build/"
54
50
# Create function directory
@@ -61,19 +57,18 @@ RUN . /home/venv/bin/activate && \
61
57
make init build test && \
62
58
mv ./dist/awslambdaric-*.tar.gz ./dist/awslambdaric-test.tar.gz
63
59
60
+
61
+
64
62
# Include global args in this stage of the build
65
63
ARG FUNCTION_DIR="/home/app/"
66
64
# Create function directory
67
65
RUN mkdir -p ${FUNCTION_DIR}
68
66
# Copy function code
69
67
COPY tests/integration/test-handlers/echo/* ${FUNCTION_DIR}
70
- # Copy Runtime Interface Client .tgz
71
- RUN cp ./dist/awslambdaric-test.tar.gz ${FUNCTION_DIR}/awslambdaric-test.tar.gz
72
-
73
68
# Install the function's dependencies
74
69
WORKDIR ${FUNCTION_DIR}
75
- RUN python${RUNTIME_VERSION} -m pip install awslambdaric-test.tar.gz --target ${FUNCTION_DIR} && \
76
- rm awslambdaric-test.tar.gz
70
+ RUN . /home/venv/bin/activate && \
71
+ pip install ${RIC_BUILD_DIR}/dist/ awslambdaric-test.tar.gz --target ${FUNCTION_DIR}
77
72
78
73
79
74
0 commit comments