@@ -9,46 +9,45 @@ ENV DEBIAN_FRONTEND=noninteractive
9
9
ARG RUNTIME_VERSION
10
10
11
11
# Install python and pip
12
- RUN apt-get update && \
13
- apt-get install -y \
14
- software-properties-common
12
+ RUN apt-get update && apt-get install -y software-properties-common
15
13
RUN add-apt-repository ppa:deadsnakes/ppa
16
14
RUN apt-get update && \
17
- apt-get install -y \
18
- curl \
19
- python${RUNTIME_VERSION}
20
-
21
- # specific distutils package name for ubuntu24.04
22
- RUN if [ ${RUNTIME_VERSION} == "3.12" ] && [ ${DISTRO_VERSION} == "24.04" ]; then \
23
- apt-get install -y python3-distutils-extra; \
24
- else \
25
- apt-get install -y python${RUNTIME_VERSION}-distutils; \
26
- fi
15
+ apt-get install -y curl python${RUNTIME_VERSION}
27
16
28
17
RUN ln -s /usr/bin/python${RUNTIME_VERSION} /usr/local/bin/python3
29
18
19
+
20
+
21
+
30
22
# Stage 2 - build function and dependencies
31
23
FROM python-image AS python-ubuntu-builder
32
24
33
25
ARG RUNTIME_VERSION
34
26
35
- RUN curl "https://bootstrap.pypa.io/get-pip.py" -o "get-pip.py"
36
- RUN python${RUNTIME_VERSION} get-pip.py
37
-
38
27
# Install aws-lambda-cpp build dependencies
39
28
RUN apt-get update && \
40
- apt-get install -y \
41
- g++ \
42
- gcc \
43
- tar \
44
- gzip \
45
- make \
46
- cmake \
47
- autoconf \
48
- automake \
49
- libtool \
50
- libcurl4-openssl-dev \
51
- python${RUNTIME_VERSION}-dev
29
+ apt-get install -y \
30
+ g++ \
31
+ gcc \
32
+ tar \
33
+ gzip \
34
+ make \
35
+ cmake \
36
+ autoconf \
37
+ automake \
38
+ libtool \
39
+ libcurl4-openssl-dev \
40
+ python${RUNTIME_VERSION}-dev
41
+
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
52
51
53
52
# Include global args in this stage of the build
54
53
ARG RIC_BUILD_DIR="/home/build/"
@@ -57,7 +56,9 @@ RUN mkdir -p ${RIC_BUILD_DIR}
57
56
# Copy function code and Runtime Interface Client .tgz
58
57
WORKDIR ${RIC_BUILD_DIR}
59
58
COPY . .
60
- RUN make init build test && \
59
+ RUN . /home/venv/bin/activate && \
60
+ pip install setuptools && \
61
+ make init build test && \
61
62
mv ./dist/awslambdaric-*.tar.gz ./dist/awslambdaric-test.tar.gz
62
63
63
64
# Include global args in this stage of the build
@@ -71,13 +72,13 @@ RUN cp ./dist/awslambdaric-test.tar.gz ${FUNCTION_DIR}/awslambdaric-test.tar.gz
71
72
72
73
# Install the function's dependencies
73
74
WORKDIR ${FUNCTION_DIR}
74
- RUN python${RUNTIME_VERSION} -m pip install \
75
- awslambdaric-test.tar.gz \
76
- --target ${FUNCTION_DIR} && \
75
+ RUN python${RUNTIME_VERSION} -m pip install awslambdaric-test.tar.gz --target ${FUNCTION_DIR} && \
77
76
rm awslambdaric-test.tar.gz
78
77
79
78
80
- # Stage 4 - final runtime interface client image
79
+
80
+
81
+ # Stage 3 - final runtime interface client image
81
82
# Grab a fresh copy of the Python image
82
83
FROM python-image
83
84
0 commit comments