Skip to content

Commit e8fb730

Browse files
author
Alexander Smirnov
committed
Fix ubuntu24.04/3.12
1 parent 5f42ada commit e8fb730

File tree

2 files changed

+36
-34
lines changed

2 files changed

+36
-34
lines changed

tests/integration/codebuild/buildspec.os.ubuntu.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ phases:
5656
-f "${SCRATCH_DIR}/Dockerfile.echo.${OS_DISTRIBUTION}.tmp" \
5757
-t "${IMAGE_TAG}" \
5858
--build-arg RUNTIME_VERSION="${RUNTIME_VERSION}" \
59-
--build-arg DISTRO_VERSION="${DISTRO_VERSION}" --load
59+
--build-arg DISTRO_VERSION="${DISTRO_VERSION}" \
60+
--load
6061
build:
6162
commands:
6263
- set -x

tests/integration/docker/Dockerfile.echo.ubuntu

+34-33
Original file line numberDiff line numberDiff line change
@@ -9,46 +9,45 @@ ENV DEBIAN_FRONTEND=noninteractive
99
ARG RUNTIME_VERSION
1010

1111
# 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
1513
RUN add-apt-repository ppa:deadsnakes/ppa
1614
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}
2716

2817
RUN ln -s /usr/bin/python${RUNTIME_VERSION} /usr/local/bin/python3
2918

19+
20+
21+
3022
# Stage 2 - build function and dependencies
3123
FROM python-image AS python-ubuntu-builder
3224

3325
ARG RUNTIME_VERSION
3426

35-
RUN curl "https://bootstrap.pypa.io/get-pip.py" -o "get-pip.py"
36-
RUN python${RUNTIME_VERSION} get-pip.py
37-
3827
# Install aws-lambda-cpp build dependencies
3928
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
5251

5352
# Include global args in this stage of the build
5453
ARG RIC_BUILD_DIR="/home/build/"
@@ -57,7 +56,9 @@ RUN mkdir -p ${RIC_BUILD_DIR}
5756
# Copy function code and Runtime Interface Client .tgz
5857
WORKDIR ${RIC_BUILD_DIR}
5958
COPY . .
60-
RUN make init build test && \
59+
RUN . /home/venv/bin/activate && \
60+
pip install setuptools && \
61+
make init build test && \
6162
mv ./dist/awslambdaric-*.tar.gz ./dist/awslambdaric-test.tar.gz
6263

6364
# 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
7172

7273
# Install the function's dependencies
7374
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} && \
7776
rm awslambdaric-test.tar.gz
7877

7978

80-
# Stage 4 - final runtime interface client image
79+
80+
81+
# Stage 3 - final runtime interface client image
8182
# Grab a fresh copy of the Python image
8283
FROM python-image
8384

0 commit comments

Comments
 (0)