From 6c8e28f1f03f547c9a904f414c2c61d90996c031 Mon Sep 17 00:00:00 2001 From: Florentin Labelle Date: Mon, 18 Aug 2025 15:35:07 +0200 Subject: [PATCH 1/2] build: use lambda python image instead of debian --- Dockerfile | 11 +++++++++++ scripts/build_layers.sh | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 771251295..56cd1c2dd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,6 +7,17 @@ ARG runtime RUN mkdir -p /build/python/lib/$runtime/site-packages WORKDIR /build +# Install GCC +RUN set -eux; \ + if command -v dnf >/dev/null 2>&1; then \ + dnf -y install git gcc-c++; \ + else \ + yum -y install git gcc10 gcc10-c++; \ + ln -s /usr/bin/gcc10-gcc /usr/bin/gcc; \ + ln -s /usr/bin/gcc10-g++ /usr/bin/g++; \ + ln -s /usr/bin/gcc10-cc /usr/bin/cc; \ + fi + # Add Rust compiler which is needed to build dd-trace-py from source RUN curl https://sh.rustup.rs -sSf | \ sh -s -- --default-toolchain stable -y diff --git a/scripts/build_layers.sh b/scripts/build_layers.sh index a0d6ee39d..6a8087b80 100755 --- a/scripts/build_layers.sh +++ b/scripts/build_layers.sh @@ -61,7 +61,7 @@ function docker_build_zip { # between different python runtimes. temp_dir=$(mktemp -d) docker buildx build -t datadog-lambda-python-${arch}:$1 . --no-cache \ - --build-arg image=public.ecr.aws/docker/library/python:$1 \ + --build-arg image=public.ecr.aws/lambda/python:$1 \ --build-arg runtime=python$1 \ --platform linux/${arch} \ --progress=plain \ From 62693de630899be8144266946b9625f22ae962aa Mon Sep 17 00:00:00 2001 From: Florentin Labelle Date: Tue, 19 Aug 2025 09:54:25 +0200 Subject: [PATCH 2/2] use sam build-python images --- Dockerfile | 13 ++++++------- scripts/build_layers.sh | 2 +- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index 56cd1c2dd..ee4c7efdd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,15 +7,14 @@ ARG runtime RUN mkdir -p /build/python/lib/$runtime/site-packages WORKDIR /build -# Install GCC +# Install newer version of GCC on AL2 RUN set -eux; \ - if command -v dnf >/dev/null 2>&1; then \ - dnf -y install git gcc-c++; \ - else \ + if command -v yum >/dev/null 2>&1; then \ yum -y install git gcc10 gcc10-c++; \ - ln -s /usr/bin/gcc10-gcc /usr/bin/gcc; \ - ln -s /usr/bin/gcc10-g++ /usr/bin/g++; \ - ln -s /usr/bin/gcc10-cc /usr/bin/cc; \ + cd /usr/bin; \ + rm gcc && ln -s gcc10-gcc gcc; \ + rm g++ && ln -s gcc10-g++ g++; \ + rm cc && ln -s gcc10-cc cc; \ fi # Add Rust compiler which is needed to build dd-trace-py from source diff --git a/scripts/build_layers.sh b/scripts/build_layers.sh index 6a8087b80..23941b7a0 100755 --- a/scripts/build_layers.sh +++ b/scripts/build_layers.sh @@ -61,7 +61,7 @@ function docker_build_zip { # between different python runtimes. temp_dir=$(mktemp -d) docker buildx build -t datadog-lambda-python-${arch}:$1 . --no-cache \ - --build-arg image=public.ecr.aws/lambda/python:$1 \ + --build-arg image=public.ecr.aws/sam/build-python$1:1 \ --build-arg runtime=python$1 \ --platform linux/${arch} \ --progress=plain \