-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update CodeBuild images to Linux2 standard5.0 (node16 to node18) + Up…
…date Docker images to use AmazonLinux:2023 (node18 and Python3.9) (#889) ### Feature or Bugfix - Bugfix ### Detail The purpose of this PR is to upgrade any compute resource that uses node16 to node18. - CodeBuild images: [Amazon Linux 2 x86_64 standard:4.0 use node16 ](https://docs.aws.amazon.com/codebuild/latest/userguide/available-runtimes.html)which is already deprecated. In this PR we update the CodeBuild images to use Amazon Linux 2 x86_64 standard:5.0 instead - Docker images: In this PR we replace AmazonLinux2 images by [AmazonLinux2023](https://docs.aws.amazon.com/linux/al2023/ug/what-is-amazon-linux.html), the next generation of Amazon Linux from Amazon Web Services. In AmazonLinux2023 the default Python version installed is 3.9. For this reason we also upgrade the Python version in this PR. ### Relates #782 ### Security Please answer the questions below briefly where applicable, or write `N/A`. Based on [OWASP 10](https://owasp.org/Top10/en/). N/A - Does this PR introduce or modify any input fields or queries - this includes fetching data from storage outside the application (e.g. a database, an S3 bucket)? - Is the input sanitized? - What precautions are you taking before deserializing the data you consume? - Is injection prevented by parametrizing queries? - Have you ensured no `eval` or similar functions are used? - Does this PR introduce any functionality or component that requires authorization? - How have you ensured it respects the existing AuthN/AuthZ mechanisms? - Are you logging failed auth attempts? - Are you using or adding any cryptographic features? - Do you use a standard proven implementations? - Are the used keys controlled by the customer? Where are they stored? - Are you introducing any new policies/roles/users? - Have you used the least-privilege principle? How? By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
- Loading branch information
Showing
10 changed files
with
125 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,44 @@ | ||
FROM public.ecr.aws/amazonlinux/amazonlinux:2 | ||
FROM public.ecr.aws/amazonlinux/amazonlinux:2023 | ||
|
||
ARG FUNCTION_DIR="/home/app/" | ||
ARG PYTHON_VERSION=python3.8 | ||
ARG PYTHON_VERSION=python3.9 | ||
|
||
RUN yum upgrade -y;\ | ||
# Clean cache | ||
RUN dnf upgrade -y;\ | ||
find /var/tmp -name "*.rpm" -print -delete ;\ | ||
find /tmp -name "*.rpm" -print -delete ;\ | ||
yum autoremove -y; \ | ||
yum clean packages; yum clean headers; yum clean metadata; yum clean all; rm -rfv /var/cache/yum | ||
dnf autoremove -y; \ | ||
dnf clean all; rm -rfv /var/cache/dnf | ||
|
||
RUN yum -y install shadow-utils wget | ||
RUN yum -y install openssl-devel bzip2-devel libffi-devel postgresql-devel gcc unzip tar gzip | ||
RUN amazon-linux-extras install $PYTHON_VERSION | ||
RUN yum -y install python38-devel | ||
# Install libraries | ||
RUN dnf -y install \ | ||
shadow-utils wget openssl-devel bzip2-devel libffi-devel \ | ||
postgresql-devel gcc unzip tar gzip | ||
|
||
## Add your source | ||
# Install Python | ||
RUN dnf install $PYTHON_VERSION | ||
RUN dnf -y install python3-pip python3-devel | ||
|
||
## Add source | ||
WORKDIR ${FUNCTION_DIR} | ||
|
||
# App specific requirements | ||
COPY backend/requirements.txt ./requirements.txt | ||
RUN $PYTHON_VERSION -m pip install -U pip | ||
RUN $PYTHON_VERSION -m pip install -r requirements.txt -t . | ||
|
||
# Install App requirements | ||
RUN /bin/bash -c "${PYTHON_VERSION} -m pip install setuptools" | ||
RUN /bin/bash -c "${PYTHON_VERSION} -m pip install -r requirements.txt" | ||
|
||
# App code | ||
COPY backend/. ./ | ||
|
||
# App configuration file | ||
ENV config_location="config.json" | ||
COPY config.json ./config.json | ||
|
||
## You must add the Lambda Runtime Interface Client (RIC) for your runtime. | ||
RUN $PYTHON_VERSION -m pip install awslambdaric --target ${FUNCTION_DIR} | ||
|
||
# Command can be overwritten by providing a different command in the template directly. | ||
ENTRYPOINT [ "python3.8", "-m", "awslambdaric" ] | ||
ENTRYPOINT [ "python3.9", "-m", "awslambdaric" ] | ||
CMD ["auth_handler.handler"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.