Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: Use aws-sam-cli docker images (#2066) * Add Source for Docker Build Images (#2078) * chore: Bump AWS SAM CLI Version (#2079) * Version bump (#2080) * chore: Bump AWS SAM CLI Version * Change SAM CLI Version Number There is a conflict betweeen PyPi documentation which asks for the previous style https://packaging.python.org/guides/distributing-packages-using-setuptools/#pre-release-versioning and PEP 440 which proposes the style included in this change https://www.python.org/dev/peps/pep-0440/#pre-releases - our MSI build scripts failed on the pattern we were using before, this changes the pattern. * refactor: Build init.go with -s and -w flags to removed debug info (#2083) * refactor: Bake Rapid into image on the fly (#2100) * refactor: Bake Rapid into image on the fly * force chmod on init binary in container for windows * bake go debug bootstrap Co-authored-by: Jacob Fuss <jfuss@users.noreply.github.com> * chore: Bump version to RC2 (#2104) * Remove liblzma and libxslt from AL2 build images (#2109) Discovered a regression where on Ruby 2.7, the `nokogiri` dependency would build without errors, but would not run on local testing or on AWS Lambda itself. On further investigation, it appears that `nokogiri` can compile with or without `liblzma` present, but if it is present in the build enviornment (pre-change) and it is not present on the invoke environment (true in AL2 runtimes), you will experience runtime failures attempting to require `nokogiri`. I have been able to verify that with these changes, `nokogiri` builds correctly for Ruby 2.7 and runs both locally and on AWS Lambda. * Build output dots (#2112) * Use Low-Level Docker Client Allows us to stream dots as a progress heartbeat. Pending unit tests and black formatting. * Get make pr Passing Co-authored-by: Jacob Fuss <32497805+jfuss@users.noreply.github.com> Co-authored-by: Jacob Fuss <jfuss@users.noreply.github.com>
- Loading branch information
1 parent
ce5ff5f
commit 6b7860e
Showing
38 changed files
with
9,048 additions
and
156 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,6 @@ | ||
AWS SAM CLI | ||
Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
|
||
Contents of the samcli/local/rapid and samcli/local/go-bootstrap folder forked from the original Open Source MIT licensed project lambci/docker-lambda: https://github.com/lambci/docker-lambda/ | ||
Copyright 2016 Michael Hart and LambCI contributors | ||
Portions Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. |
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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
Contents of the samcli/local/rapid and samcli/local/go-bootstrap folder forked from the original Open Source MIT licensed project lambci/docker-lambda: https://github.com/lambci/docker-lambda/ | ||
|
||
Copyright 2016 Michael Hart and LambCI contributors | ||
Portions Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
this software and associated documentation files (the "Software"), to deal in | ||
the Software without restriction, including without limitation the rights to | ||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies | ||
of the Software, and to permit persons to whom the Software is furnished to do | ||
so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,72 @@ | ||
FROM amazon/aws-sam-cli-emulation-image-java11 | ||
|
||
# We need yum to install some of the packages to help building sam applications in container. | ||
# Some of the emulation images are based on AL1 (eg: Java8) which already have yum installed so we | ||
# can simply use `yum install` to install necessary packages. Some emulation images which are based | ||
# on AL2 (eg: Java11) decided to trim down the image size by removing unneeded packages, so these | ||
# emulation images do not have yum. So we perform a trick where we: | ||
# 1. Copy emulation root to AL2 image (which have yum) | ||
# 2. Then install all needed packages to copied emulation root by using yum in AL2. | ||
# 3. Then copy the updated emulation image root back to emulation image. | ||
|
||
# Copying root from runtimes image to AL2 | ||
FROM amazonlinux:2 | ||
COPY --from=0 / /rootfs | ||
|
||
# Installing by yum at copied location | ||
RUN yum groupinstall -y development --installroot=/rootfs && yum clean all | ||
RUN yum install -d1 --installroot=/rootfs -y \ | ||
yum \ | ||
tar \ | ||
gzip \ | ||
unzip \ | ||
python3 \ | ||
grep \ | ||
curl \ | ||
make \ | ||
binutils \ | ||
gcc-c++ \ | ||
procps \ | ||
libgmp3-dev \ | ||
zlib1g-dev \ | ||
libmpc-devel \ | ||
&& yum clean all | ||
|
||
# Copying root from AL2 to runtimes image | ||
FROM amazon/aws-sam-cli-emulation-image-java11 | ||
COPY --from=1 /rootfs / | ||
|
||
# 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 | ||
ARG SAM_CLI_VERSION | ||
RUN curl -Lk "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/reproducible-linux.txt && \ | ||
/usr/local/opt/sam-cli/bin/pip3 --no-cache-dir install ./aws-sam-cli-$SAM_CLI_VERSION | ||
|
||
RUN 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 | ||
|
||
# Setup Java Home | ||
|
||
ENV JAVA_HOME="/var/lang" | ||
|
||
# Install Java build tools | ||
|
||
RUN mkdir /usr/local/gradle && curl -L -o gradle.zip https://downloads.gradle-dn.com/distributions/gradle-6.2.2-bin.zip && \ | ||
unzip -d /usr/local/gradle gradle.zip && rm gradle.zip && mkdir /usr/local/maven && \ | ||
curl -L http://mirror.cc.columbia.edu/pub/software/apache/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz | \ | ||
tar -zx -C /usr/local/maven | ||
|
||
ENV PATH="/usr/local/gradle/gradle-6.2.2/bin:/usr/local/maven/apache-maven-3.6.3/bin:${PATH}" | ||
|
||
COPY ATTRIBUTION.txt / |
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 |
---|---|---|
@@ -0,0 +1,72 @@ | ||
FROM amazon/aws-sam-cli-emulation-image-java8 | ||
|
||
# Install build tools | ||
# The base image essentially corrupts the RPM DB, | ||
# so we need to make changes for yum to run successfully. | ||
RUN chmod 1777 /tmp && \ | ||
/usr/bin/python3 -c "from configparser import SafeConfigParser; \ | ||
yum_conf = SafeConfigParser(); \ | ||
yum_conf.read('/etc/yum.conf'); \ | ||
yum_conf.has_section('main') or yum_conf.add_section('main'); \ | ||
yum_conf.set('main', 'plugins', '1'); \ | ||
f = open('/etc/yum.conf', 'w'); \ | ||
yum_conf.write(f); \ | ||
f.close();" && \ | ||
rpm --rebuilddb && \ | ||
yum groupinstall -y development && \ | ||
yum install -d1 -y \ | ||
tar \ | ||
gzip \ | ||
unzip \ | ||
python3 \ | ||
grep \ | ||
curl \ | ||
make \ | ||
gcc-c++ \ | ||
binutils \ | ||
procps \ | ||
libgmp3-dev \ | ||
zlib1g-dev \ | ||
liblzma-dev \ | ||
libxslt-devel \ | ||
libmpc-devel \ | ||
java-1.8.0-openjdk-devel \ | ||
&& yum clean all | ||
|
||
# Include build tools for the Function Build image. | ||
# /opt is used for Lambda Layers. To avoid any potential confusion or | ||
# conflict in the future, the build tools are installed in /usr/local/opt | ||
|
||
# Install AWS CLI | ||
|
||
RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" && unzip awscliv2.zip && ./aws/install && rm -rf awscliv2.zip | ||
|
||
# Install SAM CLI in a dedicated Python virtualenv | ||
ARG SAM_CLI_VERSION | ||
RUN curl -Lk "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/reproducible-linux.txt && \ | ||
/usr/local/opt/sam-cli/bin/pip3 --no-cache-dir install ./aws-sam-cli-$SAM_CLI_VERSION | ||
|
||
RUN 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 | ||
|
||
# Install Java buld tools | ||
|
||
RUN mkdir /usr/local/gradle && curl -L -o gradle.zip https://downloads.gradle-dn.com/distributions/gradle-6.2.2-bin.zip && \ | ||
unzip -d /usr/local/gradle gradle.zip && rm gradle.zip && mkdir /usr/local/maven && \ | ||
curl -L http://mirror.cc.columbia.edu/pub/software/apache/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz | \ | ||
tar -zx -C /usr/local/maven | ||
|
||
ENV PATH="/usr/local/gradle/gradle-6.2.2/bin:/usr/local/maven/apache-maven-3.6.3/bin:${PATH}" | ||
|
||
ENV JAVA_HOME="/usr/lib/jvm/java-1.8.0-openjdk" | ||
|
||
COPY ATTRIBUTION.txt / |
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 |
---|---|---|
@@ -0,0 +1,56 @@ | ||
FROM amazon/aws-sam-cli-emulation-image-nodejs10.x | ||
|
||
# To learn more context around use of `amazonlinux:2` image please read comment in java11/build/Dockerfile | ||
# Copying root from runtimes image to AL2 | ||
FROM amazonlinux:2 | ||
COPY --from=0 / /rootfs | ||
|
||
ENV PATH=/var/lang/bin:$PATH \ | ||
LD_LIBRARY_PATH=/var/lang/lib:$LD_LIBRARY_PATH \ | ||
AWS_EXECUTION_ENV=AWS_Lambda_nodejs10.x \ | ||
NODE_PATH=/opt/nodejs/node10/node_modules:/opt/nodejs/node_modules:/var/runtime/node_modules | ||
|
||
# Installing by yum at copied location | ||
RUN yum groupinstall -y development --installroot=/rootfs && yum clean all | ||
RUN yum install -d1 --installroot=/rootfs -y \ | ||
yum \ | ||
tar \ | ||
gzip \ | ||
unzip \ | ||
python3 \ | ||
grep \ | ||
curl \ | ||
make \ | ||
binutils \ | ||
gcc-c++ \ | ||
procps \ | ||
libgmp3-dev \ | ||
zlib1g-dev \ | ||
libmpc-devel \ | ||
&& yum clean all | ||
|
||
# Copying root from AL2 to runtimes image | ||
FROM amazon/aws-sam-cli-emulation-image-nodejs10.x | ||
COPY --from=1 /rootfs / | ||
|
||
# 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 | ||
ARG SAM_CLI_VERSION | ||
RUN curl -Lk "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/reproducible-linux.txt && \ | ||
/usr/local/opt/sam-cli/bin/pip3 --no-cache-dir install ./aws-sam-cli-$SAM_CLI_VERSION | ||
|
||
RUN 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 / |
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 |
---|---|---|
@@ -0,0 +1,55 @@ | ||
FROM amazon/aws-sam-cli-emulation-image-nodejs12.x | ||
|
||
# To learn more context around use of `amazonlinux:2` image please read comment in java11/build/Dockerfile | ||
# Copying root from runtimes image to AL2 | ||
FROM amazonlinux:2 | ||
COPY --from=0 / /rootfs | ||
|
||
ENV PATH=/var/lang/bin:$PATH \ | ||
LD_LIBRARY_PATH=/var/lang/lib:$LD_LIBRARY_PATH \ | ||
AWS_EXECUTION_ENV=AWS_Lambda_nodejs12.x \ | ||
NODE_PATH=/opt/nodejs/node10/node_modules:/opt/nodejs/node_modules:/var/runtime/node_modules | ||
|
||
# Installing by yum at copied location | ||
RUN yum groupinstall -y development --installroot=/rootfs && yum clean all | ||
RUN yum install -d1 --installroot=/rootfs -y \ | ||
tar \ | ||
gzip \ | ||
unzip \ | ||
python3 \ | ||
grep \ | ||
curl \ | ||
make \ | ||
binutils \ | ||
gcc-c++ \ | ||
procps \ | ||
libgmp3-dev \ | ||
zlib1g-dev \ | ||
libmpc-devel \ | ||
&& yum clean all | ||
|
||
# Copying root from AL2 to runtimes image | ||
FROM amazon/aws-sam-cli-emulation-image-nodejs12.x | ||
COPY --from=1 /rootfs / | ||
|
||
# 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 | ||
ARG SAM_CLI_VERSION | ||
RUN curl -Lk "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/reproducible-linux.txt && \ | ||
/usr/local/opt/sam-cli/bin/pip3 --no-cache-dir install ./aws-sam-cli-$SAM_CLI_VERSION | ||
|
||
RUN rm samcli.zip && rm -rf aws-sam-cli-develop | ||
|
||
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 / |
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 |
---|---|---|
@@ -0,0 +1,60 @@ | ||
FROM amazon/aws-sam-cli-emulation-image-provided:latest | ||
|
||
# Install build tools | ||
# The base image essentially corrupts the RPM DB, | ||
# so we need to make changes for yum to run successfully. | ||
RUN chmod 1777 /tmp && \ | ||
/usr/bin/python3 -c "from configparser import SafeConfigParser; \ | ||
yum_conf = SafeConfigParser(); \ | ||
yum_conf.read('/etc/yum.conf'); \ | ||
yum_conf.has_section('main') or yum_conf.add_section('main'); \ | ||
yum_conf.set('main', 'plugins', '1'); \ | ||
f = open('/etc/yum.conf', 'w'); \ | ||
yum_conf.write(f); \ | ||
f.close();" && \ | ||
rpm --rebuilddb && \ | ||
yum groupinstall -y development && \ | ||
yum install -d1 -y \ | ||
tar \ | ||
gzip \ | ||
unzip \ | ||
python3 \ | ||
grep \ | ||
curl \ | ||
make \ | ||
gcc-c++ \ | ||
binutils \ | ||
procps \ | ||
libgmp3-dev \ | ||
zlib1g-dev \ | ||
liblzma-dev \ | ||
libxslt-devel \ | ||
libmpc-devel \ | ||
&& yum clean all | ||
|
||
# Include build tools for the Function Build image. | ||
# /opt is used for Lambda Layers. To avoid any potential confusion or | ||
# conflict in the future, the build tools are installed in /usr/local/opt | ||
|
||
# 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 | ||
ENV SAM_CLI_VERSION=0.53.0 | ||
RUN curl -Lk "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 && \ | ||
sed 's/regex==2019.8.19/regex==2020.4.4/' ./aws-sam-cli-$SAM_CLI_VERSION/requirements/isolated.txt > ./aws-sam-cli-$SAM_CLI_VERSION/requirements/isolated.txt && \ | ||
/usr/local/opt/sam-cli/bin/pip3 --no-cache-dir install -r ./aws-sam-cli-$SAM_CLI_VERSION/requirements/isolated.txt && \ | ||
/usr/local/opt/sam-cli/bin/pip3 --no-cache-dir install ./aws-sam-cli-$SAM_CLI_VERSION | ||
|
||
RUN rm samcli.zip && rm -rf aws-sam-cli-$SAM_CLI_VERSION | ||
|
||
ENV PATH=$PATH:/usr/local/opt/sam-cli/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 | ||
|
||
ENV LANG=en_US.UTF-8 | ||
|
||
ENV PATH=/var/lang/bin:$PATH |
Oops, something went wrong.