From e94791ce04b0e1f1ba0619be35a880051d5df873 Mon Sep 17 00:00:00 2001 From: Lucas <12496191+lucashuy@users.noreply.github.com> Date: Fri, 20 Oct 2023 16:04:17 -0700 Subject: [PATCH] Update all images that build SAM CLI from source to use py38 --- build-image-src/Dockerfile-dotnet6 | 15 ++++++++++++--- build-image-src/Dockerfile-dotnet7 | 17 +++++++++++++---- build-image-src/Dockerfile-java11 | 15 ++++++++++++--- build-image-src/Dockerfile-java17 | 15 ++++++++++++--- build-image-src/Dockerfile-java8_al2 | 17 +++++++++++++---- build-image-src/Dockerfile-nodejs12x | 12 +++++++++--- build-image-src/Dockerfile-nodejs14x | 17 +++++++++++++---- build-image-src/Dockerfile-nodejs16x | 15 ++++++++++++--- build-image-src/Dockerfile-nodejs18x | 16 ++++++++++++---- build-image-src/Dockerfile-provided_al2 | 15 ++++++++++++--- build-image-src/Dockerfile-ruby27 | 15 ++++++++++++--- build-image-src/Dockerfile-ruby32 | 15 ++++++++++++--- 12 files changed, 144 insertions(+), 40 deletions(-) diff --git a/build-image-src/Dockerfile-dotnet6 b/build-image-src/Dockerfile-dotnet6 index f4e23b5..bd1c6d3 100644 --- a/build-image-src/Dockerfile-dotnet6 +++ b/build-image-src/Dockerfile-dotnet6 @@ -7,7 +7,6 @@ RUN yum groupinstall -y development && \ tar \ gzip \ unzip \ - python3 \ jq \ grep \ curl \ @@ -19,8 +18,18 @@ RUN yum groupinstall -y development && \ libgmp3-dev \ zlib1g-dev \ libmpc-devel \ - python3-devel \ - && yum clean all + amazon-linux-extras + +# Install extras so that Python 3.8 is installable +# https://aws.amazon.com/amazon-linux-2/faqs/#Amazon_Linux_Extras +RUN amazon-linux-extras enable python3.8 && \ + yum clean metadata && \ + yum install -y python3.8 python3.8-devel && \ + yum clean all && \ + ln -s /usr/bin/python3.8 /usr/bin/python3 && \ + ln -s /usr/bin/pip3.8 /usr/bin/pip3 && \ + python3 --version && \ + pip3 --version # Install AWS CLI ARG AWS_CLI_ARCH diff --git a/build-image-src/Dockerfile-dotnet7 b/build-image-src/Dockerfile-dotnet7 index e9031e9..bca42ad 100644 --- a/build-image-src/Dockerfile-dotnet7 +++ b/build-image-src/Dockerfile-dotnet7 @@ -7,7 +7,6 @@ RUN yum groupinstall -y development && \ tar \ gzip \ unzip \ - python3 \ jq \ grep \ curl \ @@ -19,12 +18,22 @@ RUN yum groupinstall -y development && \ libgmp3-dev \ zlib1g-dev \ libmpc-devel \ - python3-devel \ + amazon-linux-extras \ clang krb5-devel \ openssl-devel \ llvm \ - libicu \ - && yum clean all + libicu + +# Install extras so that Python 3.8 is installable +# https://aws.amazon.com/amazon-linux-2/faqs/#Amazon_Linux_Extras +RUN amazon-linux-extras enable python3.8 && \ + yum clean metadata && \ + yum install -y python3.8 python3.8-devel && \ + yum clean all && \ + ln -s /usr/bin/python3.8 /usr/bin/python3 && \ + ln -s /usr/bin/pip3.8 /usr/bin/pip3 && \ + python3 --version && \ + pip3 --version # Install AWS CLI ARG AWS_CLI_ARCH diff --git a/build-image-src/Dockerfile-java11 b/build-image-src/Dockerfile-java11 index e5b325e..4987559 100644 --- a/build-image-src/Dockerfile-java11 +++ b/build-image-src/Dockerfile-java11 @@ -7,7 +7,6 @@ RUN yum groupinstall -y development && \ tar \ gzip \ unzip \ - python3 \ jq \ grep \ curl \ @@ -19,8 +18,18 @@ RUN yum groupinstall -y development && \ libgmp3-dev \ zlib1g-dev \ libmpc-devel \ - python3-devel \ - && yum clean all + amazon-linux-extras + +# Install extras so that Python 3.8 is installable +# https://aws.amazon.com/amazon-linux-2/faqs/#Amazon_Linux_Extras +RUN amazon-linux-extras enable python3.8 && \ + yum clean metadata && \ + yum install -y python3.8 python3.8-devel && \ + yum clean all && \ + ln -s /usr/bin/python3.8 /usr/bin/python3 && \ + ln -s /usr/bin/pip3.8 /usr/bin/pip3 && \ + python3 --version && \ + pip3 --version # Install AWS CLI ARG AWS_CLI_ARCH diff --git a/build-image-src/Dockerfile-java17 b/build-image-src/Dockerfile-java17 index b83a0c7..7ab6096 100644 --- a/build-image-src/Dockerfile-java17 +++ b/build-image-src/Dockerfile-java17 @@ -7,7 +7,6 @@ RUN yum groupinstall -y development && \ tar \ gzip \ unzip \ - python3 \ jq \ grep \ curl \ @@ -19,8 +18,18 @@ RUN yum groupinstall -y development && \ libgmp3-dev \ zlib1g-dev \ libmpc-devel \ - python3-devel \ - && yum clean all + amazon-linux-extras + +# Install extras so that Python 3.8 is installable +# https://aws.amazon.com/amazon-linux-2/faqs/#Amazon_Linux_Extras +RUN amazon-linux-extras enable python3.8 && \ + yum clean metadata && \ + yum install -y python3.8 python3.8-devel && \ + yum clean all && \ + ln -s /usr/bin/python3.8 /usr/bin/python3 && \ + ln -s /usr/bin/pip3.8 /usr/bin/pip3 && \ + python3 --version && \ + pip3 --version # Install AWS CLI ARG AWS_CLI_ARCH diff --git a/build-image-src/Dockerfile-java8_al2 b/build-image-src/Dockerfile-java8_al2 index f0b68f2..9432a87 100644 --- a/build-image-src/Dockerfile-java8_al2 +++ b/build-image-src/Dockerfile-java8_al2 @@ -7,7 +7,6 @@ RUN yum groupinstall -y development && \ tar \ gzip \ unzip \ - python3 \ jq \ grep \ curl \ @@ -21,9 +20,19 @@ RUN yum groupinstall -y development && \ liblzma-dev \ libxslt-devel \ libmpc-devel \ - python3-devel \ - java-1.8.0-openjdk-devel \ - && yum clean all + amazon-linux-extras \ + java-1.8.0-openjdk-devel + +# Install extras so that Python 3.8 is installable +# https://aws.amazon.com/amazon-linux-2/faqs/#Amazon_Linux_Extras +RUN amazon-linux-extras enable python3.8 && \ + yum clean metadata && \ + yum install -y python3.8 python3.8-devel && \ + yum clean all && \ + ln -s /usr/bin/python3.8 /usr/bin/python3 && \ + ln -s /usr/bin/pip3.8 /usr/bin/pip3 && \ + python3 --version && \ + pip3 --version # Install AWS CLI ARG AWS_CLI_ARCH diff --git a/build-image-src/Dockerfile-nodejs12x b/build-image-src/Dockerfile-nodejs12x index 25c961d..87ef4d5 100644 --- a/build-image-src/Dockerfile-nodejs12x +++ b/build-image-src/Dockerfile-nodejs12x @@ -12,7 +12,6 @@ RUN yum groupinstall -y development && \ tar \ gzip \ unzip \ - python3 \ jq \ grep \ curl \ @@ -24,8 +23,15 @@ RUN yum groupinstall -y development && \ libgmp3-dev \ zlib1g-dev \ libmpc-devel \ - python3-devel \ - && yum clean all + amazon-linux-extras + +# Install extras so that Python 3.8 is installable +# https://aws.amazon.com/amazon-linux-2/faqs/#Amazon_Linux_Extras +RUN amazon-linux-extras install -y python3.8 && \ + ln -s /usr/bin/python3.8 /usr/bin/python3 && \ + ln -s /usr/bin/pip3.8 /usr/bin/pip3 && \ + python3 --version && \ + pip3 --version # Install AWS CLI ARG AWS_CLI_ARCH diff --git a/build-image-src/Dockerfile-nodejs14x b/build-image-src/Dockerfile-nodejs14x index 049ff54..e9701bf 100644 --- a/build-image-src/Dockerfile-nodejs14x +++ b/build-image-src/Dockerfile-nodejs14x @@ -12,7 +12,6 @@ RUN yum groupinstall -y development && \ tar \ gzip \ unzip \ - python3 \ jq \ grep \ curl \ @@ -24,8 +23,18 @@ RUN yum groupinstall -y development && \ libgmp3-dev \ zlib1g-dev \ libmpc-devel \ - python3-devel \ - && yum clean all + amazon-linux-extras + +# Install extras so that Python 3.8 is installable +# https://aws.amazon.com/amazon-linux-2/faqs/#Amazon_Linux_Extras +RUN amazon-linux-extras enable python3.8 && \ + yum clean metadata && \ + yum install -y python38 python38-devel && \ + yum clean all && \ + ln -s /usr/bin/python3.8 /usr/bin/python3 && \ + ln -s /usr/bin/pip3.8 /usr/bin/pip3 && \ + python3 --version && \ + pip3 --version # Install AWS CLI ARG AWS_CLI_ARCH @@ -33,7 +42,7 @@ RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-$AWS_CLI_ARCH.zip" -o "a # Install SAM CLI in a dedicated Python virtualenv ARG SAM_CLI_VERSION -RUN curl -L "https://github.com/awslabs/aws-sam-cli/archive/v$SAM_CLI_VERSION.zip" -o "samcli.zip" && \ +RUN curl -L "https://github.com/lucashuy/aws-sam-cli/archive/$SAM_CLI_VERSION.zip" -o "samcli.zip" && \ unzip samcli.zip && python3 -m venv /usr/local/opt/sam-cli && \ /usr/local/opt/sam-cli/bin/pip3 --no-cache-dir install -r ./aws-sam-cli-$SAM_CLI_VERSION/requirements/base.txt && \ /usr/local/opt/sam-cli/bin/pip3 --no-cache-dir install ./aws-sam-cli-$SAM_CLI_VERSION && \ diff --git a/build-image-src/Dockerfile-nodejs16x b/build-image-src/Dockerfile-nodejs16x index 3baf902..7a86326 100644 --- a/build-image-src/Dockerfile-nodejs16x +++ b/build-image-src/Dockerfile-nodejs16x @@ -12,7 +12,6 @@ RUN yum groupinstall -y development && \ tar \ gzip \ unzip \ - python3 \ jq \ grep \ curl \ @@ -24,8 +23,18 @@ RUN yum groupinstall -y development && \ libgmp3-dev \ zlib1g-dev \ libmpc-devel \ - python3-devel \ - && yum clean all + amazon-linux-extras + +# Install extras so that Python 3.8 is installable +# https://aws.amazon.com/amazon-linux-2/faqs/#Amazon_Linux_Extras +RUN amazon-linux-extras enable python3.8 && \ + yum clean metadata && \ + yum install -y python3.8 python3.8-devel && \ + yum clean all && \ + ln -s /usr/bin/python3.8 /usr/bin/python3 && \ + ln -s /usr/bin/pip3.8 /usr/bin/pip3 && \ + python3 --version && \ + pip3 --version # Install AWS CLI ARG AWS_CLI_ARCH diff --git a/build-image-src/Dockerfile-nodejs18x b/build-image-src/Dockerfile-nodejs18x index 3c2564d..6f1063e 100644 --- a/build-image-src/Dockerfile-nodejs18x +++ b/build-image-src/Dockerfile-nodejs18x @@ -6,14 +6,12 @@ ENV PATH=/var/lang/bin:$PATH \ AWS_EXECUTION_ENV=AWS_Lambda_nodejs18.x \ NODE_PATH=/opt/nodejs/node18/node_modules:/opt/nodejs/node_modules:/var/runtime/node_modules -# Installing by yum at copied location RUN yum groupinstall -y development && \ yum install -d1 -y \ yum \ tar \ gzip \ unzip \ - python3 \ jq \ grep \ curl \ @@ -25,8 +23,18 @@ RUN yum groupinstall -y development && \ libgmp3-dev \ zlib1g-dev \ libmpc-devel \ - python3-devel \ - && yum clean all + amazon-linux-extras + +# Install extras so that Python 3.8 is installable +# https://aws.amazon.com/amazon-linux-2/faqs/#Amazon_Linux_Extras +RUN amazon-linux-extras enable python3.8 && \ + yum clean metadata && \ + yum install -y python3.8 python3.8-devel && \ + yum clean all && \ + ln -s /usr/bin/python3.8 /usr/bin/python3 && \ + ln -s /usr/bin/pip3.8 /usr/bin/pip3 && \ + python3 --version && \ + pip3 --version # Install AWS CLI ARG AWS_CLI_ARCH diff --git a/build-image-src/Dockerfile-provided_al2 b/build-image-src/Dockerfile-provided_al2 index 9cf490c..3543d08 100644 --- a/build-image-src/Dockerfile-provided_al2 +++ b/build-image-src/Dockerfile-provided_al2 @@ -7,7 +7,6 @@ RUN yum groupinstall -y development && \ tar \ gzip \ unzip \ - python3 \ jq \ grep \ curl \ @@ -21,8 +20,18 @@ RUN yum groupinstall -y development && \ liblzma-dev \ libxslt-devel \ libmpc-devel \ - python3-devel \ - && yum clean all + amazon-linux-extras + +# Install extras so that Python 3.8 is installable +# https://aws.amazon.com/amazon-linux-2/faqs/#Amazon_Linux_Extras +RUN amazon-linux-extras enable python3.8 && \ + yum clean metadata && \ + yum install -y python3.8 python3.8-devel && \ + yum clean all && \ + ln -s /usr/bin/python3.8 /usr/bin/python3 && \ + ln -s /usr/bin/pip3.8 /usr/bin/pip3 && \ + python3 --version && \ + pip3 --version # Install AWS CLI ARG AWS_CLI_ARCH diff --git a/build-image-src/Dockerfile-ruby27 b/build-image-src/Dockerfile-ruby27 index b48eaaa..d54c813 100644 --- a/build-image-src/Dockerfile-ruby27 +++ b/build-image-src/Dockerfile-ruby27 @@ -7,7 +7,6 @@ RUN yum groupinstall -y development && \ tar \ gzip \ unzip \ - python3 \ jq \ grep \ curl \ @@ -19,8 +18,18 @@ RUN yum groupinstall -y development && \ libgmp3-dev \ zlib1g-dev \ libmpc-devel \ - python3-devel \ - && yum clean all + amazon-linux-extras + +# Install extras so that Python 3.8 is installable +# https://aws.amazon.com/amazon-linux-2/faqs/#Amazon_Linux_Extras +RUN amazon-linux-extras enable python3.8 && \ + yum clean metadata && \ + yum install -y python3.8 python3.8-devel && \ + yum clean all && \ + ln -s /usr/bin/python3.8 /usr/bin/python3 && \ + ln -s /usr/bin/pip3.8 /usr/bin/pip3 && \ + python3 --version && \ + pip3 --version RUN gem update --system --no-document diff --git a/build-image-src/Dockerfile-ruby32 b/build-image-src/Dockerfile-ruby32 index b2b752c..e14b0d7 100644 --- a/build-image-src/Dockerfile-ruby32 +++ b/build-image-src/Dockerfile-ruby32 @@ -7,7 +7,6 @@ RUN yum groupinstall -y development && \ tar \ gzip \ unzip \ - python3 \ jq \ grep \ curl \ @@ -19,8 +18,18 @@ RUN yum groupinstall -y development && \ libgmp3-dev \ zlib1g-dev \ libmpc-devel \ - python3-devel \ - && yum clean all + amazon-linux-extras + +# Install extras so that Python 3.8 is installable +# https://aws.amazon.com/amazon-linux-2/faqs/#Amazon_Linux_Extras +RUN amazon-linux-extras enable python3.8 && \ + yum clean metadata && \ + yum install -y python3.8 python3.8-devel && \ + yum clean all && \ + ln -s /usr/bin/python3.8 /usr/bin/python3 && \ + ln -s /usr/bin/pip3.8 /usr/bin/pip3 && \ + python3 --version && \ + pip3 --version RUN gem update --system --no-document