diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 51868b4..951e7e2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,7 +14,9 @@ on: jobs: run-workflow: name: Parent PR Status Check - if: always() + # If any dependent jobs fails, this WF skips which won't block merging PRs + # calling always() is required for this WF to run all the time + if: github.repository_owner == 'aws' && always() runs-on: ubuntu-latest needs: - build-single-arch @@ -72,6 +74,7 @@ jobs: - "nodejs16x" - "nodejs18x" - "provided_al2" + - "provided_al2023" - "python38" - "python39" - "python310" diff --git a/Makefile b/Makefile index f14f30a..dba9307 100644 --- a/Makefile +++ b/Makefile @@ -19,6 +19,7 @@ IS_nodejs14x := nodejs14.x IS_nodejs16x := nodejs16.x IS_nodejs18x := nodejs18.x IS_provided_al2 := provided.al2 +IS_provided_al2023 := provided.al2023 IS_python38 := python3.8 IS_python39 := python3.9 IS_python310 := python3.10 @@ -52,7 +53,7 @@ build-single-arch: pre-build build-multi-arch: pre-build docker build -f build-image-src/Dockerfile-$(RUNTIME) -t amazon/aws-sam-cli-build-image-$(IS_$(RUNTIME)):x86_64 --platform linux/amd64 --build-arg SAM_CLI_VERSION=$(SAM_CLI_VERSION) --build-arg AWS_CLI_ARCH=x86_64 --build-arg IMAGE_ARCH=x86_64 ./build-image-src - docker run --rm --privileged multiarch/qemu-user-static --reset -p yes + docker run --privileged --rm tonistiigi/binfmt --install arm64 docker build -f build-image-src/Dockerfile-$(RUNTIME) -t amazon/aws-sam-cli-build-image-$(IS_$(RUNTIME)):arm64 --platform linux/arm64 --build-arg SAM_CLI_VERSION=$(SAM_CLI_VERSION) --build-arg AWS_CLI_ARCH=aarch64 --build-arg IMAGE_ARCH=arm64 ./build-image-src test: pre-build diff --git a/build-image-src/Dockerfile-dotnet6 b/build-image-src/Dockerfile-dotnet6 index f4e23b5..f266365 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 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 diff --git a/build-image-src/Dockerfile-dotnet7 b/build-image-src/Dockerfile-dotnet7 index e9031e9..780bc90 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,24 @@ 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 + +RUN yum remove -y python3 python3-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 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 diff --git a/build-image-src/Dockerfile-java11 b/build-image-src/Dockerfile-java11 index e5b325e..4f53d1b 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 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 diff --git a/build-image-src/Dockerfile-java17 b/build-image-src/Dockerfile-java17 index b83a0c7..8620823 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 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 diff --git a/build-image-src/Dockerfile-java8_al2 b/build-image-src/Dockerfile-java8_al2 index f0b68f2..c19d485 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 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 diff --git a/build-image-src/Dockerfile-nodejs12x b/build-image-src/Dockerfile-nodejs12x index 25c961d..845fe53 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,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 diff --git a/build-image-src/Dockerfile-nodejs14x b/build-image-src/Dockerfile-nodejs14x index 049ff54..a833082 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 diff --git a/build-image-src/Dockerfile-nodejs16x b/build-image-src/Dockerfile-nodejs16x index 3baf902..262f62a 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 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 diff --git a/build-image-src/Dockerfile-nodejs18x b/build-image-src/Dockerfile-nodejs18x index 3c2564d..df6b603 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 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 diff --git a/build-image-src/Dockerfile-provided_al2 b/build-image-src/Dockerfile-provided_al2 index 9cf490c..4973ae6 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 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 diff --git a/build-image-src/Dockerfile-provided_al2023 b/build-image-src/Dockerfile-provided_al2023 new file mode 100644 index 0000000..cf2c376 --- /dev/null +++ b/build-image-src/Dockerfile-provided_al2023 @@ -0,0 +1,45 @@ +ARG IMAGE_ARCH +FROM public.ecr.aws/lambda/provided:al2023-$IMAGE_ARCH + +RUN dnf install -y tar\ + gzip \ + unzip \ + python3 \ + jq \ + grep \ + make \ + rsync \ + binutils \ + gcc-c++ \ + procps \ + libxslt-devel \ + libmpc-devel \ + python3-devel \ + && dnf clean all + +# Install AWS CLI +ARG AWS_CLI_ARCH +RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-$AWS_CLI_ARCH.zip" -o "awscliv2.zip" +RUN unzip awscliv2.zip && ./aws/install && rm awscliv2.zip && rm -rf ./aws + +# 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" && \ + 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 && \ + rm samcli.zip && rm -rf aws-sam-cli-$SAM_CLI_VERSION + +ENV PATH=$PATH:/usr/local/opt/sam-cli/bin + +ENV LANG=en_US.UTF-8 + +# Wheel is required by SAM CLI to build libraries like cryptography. It needs to be installed in the system +# Python for it to be picked up during `sam build` +RUN pip3 install wheel + +COPY ATTRIBUTION.txt / + +# Compatible with initial base image +ENTRYPOINT [] +CMD ["/bin/bash"] diff --git a/build-image-src/Dockerfile-python37 b/build-image-src/Dockerfile-python37 index 10006b0..8fdbcb8 100644 --- a/build-image-src/Dockerfile-python37 +++ b/build-image-src/Dockerfile-python37 @@ -27,18 +27,24 @@ RUN yum groupinstall -y development && \ # Install AWS CLI RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" && unzip awscliv2.zip && ./aws/install && rm awscliv2.zip && rm -rf ./aws -# Install SAM CLI in a dedicated Python virtualenv +# Install SAM CLI via native linux installer ARG SAM_CLI_VERSION -RUN curl -L "https://github.com/awslabs/aws-sam-cli/archive/v$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 && \ - rm samcli.zip && rm -rf aws-sam-cli-$SAM_CLI_VERSION - -ENV PATH=$PATH:/usr/local/opt/sam-cli/bin +RUN curl -L "https://github.com/aws/aws-sam-cli/releases/download/v$SAM_CLI_VERSION/aws-sam-cli-linux-x86_64.zip" -o "samcli.zip" && \ + unzip samcli.zip -d sam-installation && ./sam-installation/install && \ + rm samcli.zip && rm -rf sam-installation && sam --version ENV LANG=en_US.UTF-8 +# Prepare virtualenv for lambda builders +RUN python3 -m venv --without-pip /usr/local/opt/lambda-builders +RUN curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py +RUN /usr/local/opt/lambda-builders/bin/python3 get-pip.py +# Install lambda builders in a dedicated Python virtualenv +RUN AWS_LB_VERSION=$(curl -sSL https://raw.githubusercontent.com/aws/aws-sam-cli/v$SAM_CLI_VERSION/requirements/base.txt | grep aws_lambda_builders | cut -d= -f3) && \ + /usr/local/opt/lambda-builders/bin/pip3 --no-cache-dir install "aws-lambda-builders==$AWS_LB_VERSION" + +ENV PATH=$PATH:/usr/local/opt/lambda-builders/bin + # Wheel is required by SAM CLI to build libraries like cryptography. It needs to be installed in the system # Python for it to be picked up during `sam build` RUN pip3 install wheel diff --git a/build-image-src/Dockerfile-ruby27 b/build-image-src/Dockerfile-ruby27 index b48eaaa..6b8497e 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 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 RUN gem update --system --no-document diff --git a/build-image-src/Dockerfile-ruby32 b/build-image-src/Dockerfile-ruby32 index b2b752c..bcebe8e 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 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 RUN gem update --system --no-document diff --git a/build-image-src/build_all_images.sh b/build-image-src/build_all_images.sh index a290006..73d6df7 100755 --- a/build-image-src/build_all_images.sh +++ b/build-image-src/build_all_images.sh @@ -35,6 +35,7 @@ docker build -f Dockerfile-nodejs14x -t amazon/aws-sam-cli-build-image-nodejs14. docker build -f Dockerfile-nodejs16x -t amazon/aws-sam-cli-build-image-nodejs16.x:x86_64 --platform linux/amd64 --build-arg SAM_CLI_VERSION=$SAM_CLI_VERSION --build-arg AWS_CLI_ARCH=x86_64 --build-arg IMAGE_ARCH=x86_64 . & docker build -f Dockerfile-nodejs18x -t amazon/aws-sam-cli-build-image-nodejs18.x:x86_64 --platform linux/amd64 --build-arg SAM_CLI_VERSION=$SAM_CLI_VERSION --build-arg AWS_CLI_ARCH=x86_64 --build-arg IMAGE_ARCH=x86_64 . & docker build -f Dockerfile-provided_al2 -t amazon/aws-sam-cli-build-image-provided.al2:x86_64 --platform linux/amd64 --build-arg SAM_CLI_VERSION=$SAM_CLI_VERSION --build-arg AWS_CLI_ARCH=x86_64 --build-arg IMAGE_ARCH=x86_64 . & +docker build -f Dockerfile-provided_al2023 -t amazon/aws-sam-cli-build-image-provided.al2023:x86_64 --platform linux/amd64 --build-arg SAM_CLI_VERSION=$SAM_CLI_VERSION --build-arg AWS_CLI_ARCH=x86_64 --build-arg IMAGE_ARCH=x86_64 . & docker build -f Dockerfile-python38 -t amazon/aws-sam-cli-build-image-python3.8:x86_64 --platform linux/amd64 --build-arg SAM_CLI_VERSION=$SAM_CLI_VERSION --build-arg AWS_CLI_ARCH=x86_64 --build-arg IMAGE_ARCH=x86_64 . & docker build -f Dockerfile-python39 -t amazon/aws-sam-cli-build-image-python3.9:x86_64 --platform linux/amd64 --build-arg SAM_CLI_VERSION=$SAM_CLI_VERSION --build-arg AWS_CLI_ARCH=x86_64 --build-arg IMAGE_ARCH=x86_64 . & docker build -f Dockerfile-python310 -t amazon/aws-sam-cli-build-image-python3.10:x86_64 --platform linux/amd64 --build-arg SAM_CLI_VERSION=$SAM_CLI_VERSION --build-arg AWS_CLI_ARCH=x86_64 --build-arg IMAGE_ARCH=x86_64 . & @@ -44,7 +45,7 @@ docker build -f Dockerfile-ruby32 -t amazon/aws-sam-cli-build-image-ruby3.2:x86_ wait # Build arm64 images -docker run --rm --privileged multiarch/qemu-user-static --reset -p yes +docker run --privileged --rm tonistiigi/binfmt --install arm64 docker build -f Dockerfile-dotnet6 -t amazon/aws-sam-cli-build-image-dotnet6:arm64 --platform linux/arm64 --build-arg SAM_CLI_VERSION=$SAM_CLI_VERSION --build-arg AWS_CLI_ARCH=aarch64 --build-arg IMAGE_ARCH=arm64 . & docker build -f Dockerfile-dotnet7 -t amazon/aws-sam-cli-build-image-dotnet7:arm64 --platform linux/arm64 --build-arg SAM_CLI_VERSION=$SAM_CLI_VERSION --build-arg AWS_CLI_ARCH=aarch64 --build-arg IMAGE_ARCH=arm64 . & docker build -f Dockerfile-java8_al2 -t amazon/aws-sam-cli-build-image-java8.al2:arm64 --platform linux/arm64 --build-arg SAM_CLI_VERSION=$SAM_CLI_VERSION --build-arg AWS_CLI_ARCH=aarch64 --build-arg IMAGE_ARCH=arm64 . & @@ -56,6 +57,7 @@ docker build -f Dockerfile-nodejs14x -t amazon/aws-sam-cli-build-image-nodejs14. docker build -f Dockerfile-nodejs16x -t amazon/aws-sam-cli-build-image-nodejs16.x:arm64 --platform linux/arm64 --build-arg SAM_CLI_VERSION=$SAM_CLI_VERSION --build-arg AWS_CLI_ARCH=aarch64 --build-arg IMAGE_ARCH=arm64 . & docker build -f Dockerfile-nodejs18x -t amazon/aws-sam-cli-build-image-nodejs18.x:arm64 --platform linux/arm64 --build-arg SAM_CLI_VERSION=$SAM_CLI_VERSION --build-arg AWS_CLI_ARCH=aarch64 --build-arg IMAGE_ARCH=arm64 . & docker build -f Dockerfile-provided_al2 -t amazon/aws-sam-cli-build-image-provided.al2:arm64 --platform linux/arm64 --build-arg SAM_CLI_VERSION=$SAM_CLI_VERSION --build-arg AWS_CLI_ARCH=aarch64 --build-arg IMAGE_ARCH=arm64 . & +docker build -f Dockerfile-provided_al2023 -t amazon/aws-sam-cli-build-image-provided.al2023:arm64 --platform linux/arm64 --build-arg SAM_CLI_VERSION=$SAM_CLI_VERSION --build-arg AWS_CLI_ARCH=aarch64 --build-arg IMAGE_ARCH=arm64 . & docker build -f Dockerfile-python38 -t amazon/aws-sam-cli-build-image-python3.8:arm64 --platform linux/arm64 --build-arg SAM_CLI_VERSION=$SAM_CLI_VERSION --build-arg AWS_CLI_ARCH=aarch64 --build-arg IMAGE_ARCH=arm64 . & docker build -f Dockerfile-python39 -t amazon/aws-sam-cli-build-image-python3.9:arm64 --platform linux/arm64 --build-arg SAM_CLI_VERSION=$SAM_CLI_VERSION --build-arg AWS_CLI_ARCH=aarch64 --build-arg IMAGE_ARCH=arm64 . & docker build -f Dockerfile-python310 -t amazon/aws-sam-cli-build-image-python3.10:arm64 --platform linux/arm64 --build-arg SAM_CLI_VERSION=$SAM_CLI_VERSION --build-arg AWS_CLI_ARCH=aarch64 --build-arg IMAGE_ARCH=arm64 . & diff --git a/pytest.ini b/pytest.ini index 666c5d8..c61a177 100644 --- a/pytest.ini +++ b/pytest.ini @@ -15,6 +15,7 @@ markers = nodejs16x nodejs18x provided_al2 + provided_al2023 python38 python39 python310 diff --git a/tests/build_image_base_test.py b/tests/build_image_base_test.py index 585cd2a..5526c87 100644 --- a/tests/build_image_base_test.py +++ b/tests/build_image_base_test.py @@ -8,6 +8,7 @@ class BuildImageBase(TestCase): __test__ = False + package_managers = ["yum"] @classmethod def setUpClass(cls, runtime, dockerfile, dep_manager=None, tag="x86_64"): @@ -70,13 +71,14 @@ def test_common_packages(self): ) self.assertTrue(self.is_package_present("aws")) self.assertTrue(self.is_package_present("jq")) - self.assertTrue(self.is_package_present("yum")) + for pm in self.package_managers: + self.assertTrue(self.is_package_present(pm)) def test_sam_init(self): """ Test sam init hello world application for the given runtime and dependency manager """ - if self.runtime in ["provided", "provided.al2", "dotnet7"]: + if self.runtime in ["provided", "provided.al2", "provided.al2023", "dotnet7"]: pytest.skip("Skipping sam init test for self-provided images") sam_init = f"sam init \ diff --git a/tests/test_build_images.py b/tests/test_build_images.py index 9ce7deb..5793840 100644 --- a/tests/test_build_images.py +++ b/tests/test_build_images.py @@ -736,3 +736,35 @@ def test_architecture(self): Test architecture of this build image """ self.assertTrue(self.is_architecture("aarch64")) + + +@pytest.mark.provided_al2023 +class TestBIProvidedAL2023(BuildImageBase): + __test__ = True + package_managers = ["dnf"] + + @classmethod + def setUpClass(cls): + super().setUpClass("provided.al2023", "Dockerfile-provided-al2023", tag="x86_64") + + def test_architecture(self): + """ + Test architecture of this build image + """ + self.assertTrue(self.is_architecture("x86_64")) + + +@pytest.mark.provided_al2023 +class TestBIProvidedAL2023ForArm(BuildImageBase): + __test__ = True + package_managers = ["dnf"] + + @classmethod + def setUpClass(cls): + super().setUpClass("provided.al2023", "Dockerfile-provided-al2023", tag="arm64") + + def test_architecture(self): + """ + Test architecture of this build image + """ + self.assertTrue(self.is_architecture("aarch64"))