diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 00000000..b7fdd974 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,3 @@ +# These are supported funding model platforms + +github: mhart diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml new file mode 100644 index 00000000..801ac7c5 --- /dev/null +++ b/.github/workflows/ci-build.yml @@ -0,0 +1,20 @@ +name: ci-build + +on: + push: + branches: + - master + pull_request: + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Build build Docker images + working-directory: base + run: ./build-all-build.sh + - name: List Docker images + run: | + docker images diff --git a/.github/workflows/ci-run.yml b/.github/workflows/ci-run.yml new file mode 100644 index 00000000..880bb7df --- /dev/null +++ b/.github/workflows/ci-run.yml @@ -0,0 +1,20 @@ +name: ci-run + +on: + push: + branches: + - master + pull_request: + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Build run Docker images + working-directory: base + run: ./build-all-run.sh + - name: List Docker images + run: | + docker images diff --git a/.gitignore b/.gitignore index 4525d854..97b322a1 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,8 @@ base/diff-2 base/tar-find-layer/layer.zip base/dump-java8/bin base/dump-java8/build +base/dump-java8al2/bin +base/dump-java8al2/build base/dump-java11/bin base/dump-java11/build base/dump-dotnetcore20/bin @@ -16,6 +18,8 @@ base/dump-dotnetcore21/bin base/dump-dotnetcore21/obj base/dump-dotnetcore31/bin base/dump-dotnetcore31/obj +base/dump-providedal2/bootstrap +base/dump-providedal2/bootstrap.zip dotnetcore2.0/run/MockBootstraps/bin dotnetcore2.0/run/MockBootstraps/obj dotnetcore2.1/run/MockBootstraps/bin @@ -33,3 +37,6 @@ examples/dotnetcore3.1/pub examples/java/bin examples/java/build examples/go1.x/handler +examples/go1.x/handler +examples/provided.al2/bootstrap +package-lock.json diff --git a/README.md b/README.md index 484d3257..136a5ff2 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,15 @@ +# Deprecated + +NB: these images are deprecated in favor of AWS' official images, which you can find at: + +https://github.com/aws/aws-lambda-base-images + +And browse on the ECR public gallery, eg: + +https://gallery.ecr.aws/lambda/python + +This project is now archived and will not receive any further updates. + # docker-lambda A sandboxed local environment that replicates the live [AWS Lambda](https://aws.amazon.com/lambda/) @@ -196,7 +208,7 @@ docker run --rm -v "$PWD":/var/task:ro,delegated lambci/lambda:go1.x my_handler # Test a function from the current directory on Java 11 # The directory must be laid out in the same way the Lambda zip file is, # with top-level package source directories and a `lib` directory for third-party jars -# http://docs.aws.amazon.com/lambda/latest/dg/create-deployment-pkg-zip-java.html +# https://docs.aws.amazon.com/lambda/latest/dg/java-package.html docker run --rm -v "$PWD":/var/task:ro,delegated lambci/lambda:java11 org.myorg.MyHandler # Test on .NET Core 3.1 given a test.dll assembly in the current directory, @@ -310,12 +322,14 @@ These follow the Lambda runtime names: - `ruby2.5` - `ruby2.7` - `java8` + - `java8.al2` - `java11` - `go1.x` - `dotnetcore2.0` - `dotnetcore2.1` - `dotnetcore3.1` - `provided` + - `provided.al2` - `build-nodejs4.3` - `build-nodejs6.10` - `build-nodejs8.10` @@ -328,12 +342,14 @@ These follow the Lambda runtime names: - `build-ruby2.5` - `build-ruby2.7` - `build-java8` + - `build-java8.al2` - `build-java11` - `build-go1.x` - `build-dotnetcore2.0` - `build-dotnetcore2.1` - `build-dotnetcore3.1` - `build-provided` + - `build-provided.al2` ## Verifying images @@ -393,6 +409,9 @@ Yum packages installed on build images: - `docker` (Docker in Docker!) - `clang` - `cmake` + +The build image for older Amazon Linux 1 based runtimes also include: + - `python27-devel` - `python36-devel` - `ImageMagick-devel` diff --git a/base/Dockerfile b/base/Dockerfile index ab3ea957..c3623a79 100644 --- a/base/Dockerfile +++ b/base/Dockerfile @@ -1,9 +1,16 @@ -FROM scratch +FROM amazonlinux:1 # Docker doesn't support unpacking from remote URLs with ADD, # and we don't want to 'docker import' because we can't squash into a small layer # So this is expected to be downloaded from https://lambci.s3.amazonaws.com/fs/base.tgz -ADD ./base.tgz / +ADD ./base.tgz /opt/ + +RUN yum --installroot=/opt reinstall -y filesystem-2.4.30-3.8.amzn1 && \ + yum --installroot=/opt clean all + +FROM scratch + +COPY --from=0 /opt / ENV PATH=/usr/local/bin:/usr/bin/:/bin:/opt/bin \ LD_LIBRARY_PATH=/lib64:/usr/lib64:/var/runtime:/var/runtime/lib:/var/task:/var/task/lib:/opt/lib \ @@ -23,10 +30,11 @@ ENV PATH=/usr/local/bin:/usr/bin/:/bin:/opt/bin \ AWS_XRAY_CONTEXT_MISSING=LOG_ERROR \ _X_AMZN_TRACE_ID='Root=1-dc99d00f-c079a84d433534434534ef0d;Parent=91ed514f1e5c03b2;Sampled=1' -RUN yum reinstall -y filesystem; \ +# pam has problems reinstalling from a non-standard installroot, +# so reinstall everything except filesystem here +RUN yum reinstall -y setup-2.8.14-20.12.amzn1 audit-libs-2.6.5-3.28.amzn1 shadow-utils-4.1.4.2-13.10.amzn1 \ + openssl-1.0.2k-16.152.amzn1 glibc-2.17-292.180.amzn1 glibc-common-2.17-292.180.amzn1 pam-1.1.8-12.33.amzn1 && \ yum clean all && \ - rm -rf /var/cache/yum && \ - mkdir /tmp && \ chown sbx_user1051:495 /tmp && \ chmod 700 /tmp diff --git a/base/amazonlinux1.txt b/base/amazonlinux1.txt index 773aa0bc..4d630e4b 100644 --- a/base/amazonlinux1.txt +++ b/base/amazonlinux1.txt @@ -1,22 +1,22 @@ basesystem-10.0-4.9.amzn1.noarch -bash-4.2.46-28.37.amzn1.x86_64 +bash-4.2.46-34.43.amzn1.x86_64 bzip2-libs-1.0.6-8.12.amzn1.x86_64 -ca-certificates-2018.2.22-65.1.21.amzn1.noarch +ca-certificates-2018.2.22-65.1.22.amzn1.noarch chkconfig-1.3.49.3-2.14.amzn1.x86_64 coreutils-8.22-15.52.amzn1.x86_64 -curl-7.61.1-12.93.amzn1.x86_64 +curl-7.61.1-12.95.amzn1.x86_64 cyrus-sasl-lib-2.1.23-13.16.amzn1.x86_64 db4-4.7.25-18.11.amzn1.x86_64 db4-utils-4.7.25-18.11.amzn1.x86_64 elfutils-libelf-0.168-8.19.amzn1.x86_64 -expat-2.1.0-10.21.amzn1.x86_64 -file-libs-5.37-8.48.amzn1.x86_64 +expat-2.1.0-11.22.amzn1.x86_64 +file-libs-5.37-8.49.amzn1.x86_64 filesystem-2.4.30-3.8.amzn1.x86_64 gawk-3.1.7-10.10.amzn1.x86_64 gdbm-1.8.0-36.6.amzn1.x86_64 glib2-2.36.3-5.21.amzn1.x86_64 -glibc-2.17-292.178.amzn1.x86_64 -glibc-common-2.17-292.178.amzn1.x86_64 +glibc-2.17-292.180.amzn1.x86_64 +glibc-common-2.17-292.180.amzn1.x86_64 gmp-6.0.0-11.16.amzn1.x86_64 gnupg2-2.0.28-2.33.amzn1.x86_64 gpgme-1.4.3-5.15.amzn1.x86_64 @@ -24,20 +24,20 @@ grep-2.20-3.18.amzn1.x86_64 gzip-1.5-9.19.amzn1.x86_64 info-5.1-4.10.amzn1.x86_64 keyutils-libs-1.5.8-3.12.amzn1.x86_64 -krb5-libs-1.15.1-34.44.amzn1.x86_64 +krb5-libs-1.15.1-46.48.amzn1.x86_64 libacl-2.2.49-6.11.amzn1.x86_64 libassuan-2.0.3-3.3.amzn1.x86_64 libattr-2.4.46-12.10.amzn1.x86_64 libcap-2.16-5.5.8.amzn1.x86_64 libcom_err-1.43.5-2.43.amzn1.x86_64 -libcurl-7.61.1-12.93.amzn1.x86_64 +libcurl-7.61.1-12.95.amzn1.x86_64 libffi-3.0.13-16.5.amzn1.x86_64 libgcc72-7.2.1-2.59.amzn1.x86_64 libgcrypt-1.5.3-12.19.amzn1.x86_64 libgpg-error-1.11-1.12.amzn1.x86_64 -libicu-50.1.2-11.12.amzn1.x86_64 +libicu-50.2-4.0.amzn1.x86_64 libidn2-2.3.0-1.4.amzn1.x86_64 -libnghttp2-1.31.1-2.5.amzn1.x86_64 +libnghttp2-1.33.0-1.1.6.amzn1.x86_64 libpsl-0.6.2-1.2.amzn1.x86_64 libselinux-2.1.10-3.22.amzn1.x86_64 libsepol-2.1.7-3.12.amzn1.x86_64 @@ -46,23 +46,23 @@ libstdc++72-7.2.1-2.59.amzn1.x86_64 libtasn1-2.3-6.6.amzn1.x86_64 libunistring-0.9.3-6.1.amzn1.x86_64 libverto-0.2.5-4.9.amzn1.x86_64 -libxml2-2.9.1-6.3.52.amzn1.x86_64 -libxml2-python27-2.9.1-6.3.52.amzn1.x86_64 +libxml2-2.9.1-6.4.41.amzn1.x86_64 +libxml2-python27-2.9.1-6.4.41.amzn1.x86_64 lua-5.1.4-4.1.9.amzn1.x86_64 make-3.82-21.10.amzn1.x86_64 ncurses-5.7-4.20090207.14.amzn1.x86_64 ncurses-base-5.7-4.20090207.14.amzn1.x86_64 ncurses-libs-5.7-4.20090207.14.amzn1.x86_64 -nspr-4.19.0-1.43.amzn1.x86_64 -nss-3.36.0-5.82.amzn1.x86_64 +nspr-4.21.0-1.43.amzn1.x86_64 +nss-3.44.0-7.84.amzn1.x86_64 nss-pem-1.0.3-4.3.amzn1.x86_64 -nss-softokn-3.36.0-5.42.amzn1.x86_64 -nss-softokn-freebl-3.36.0-5.42.amzn1.x86_64 -nss-sysinit-3.36.0-5.82.amzn1.x86_64 -nss-tools-3.36.0-5.82.amzn1.x86_64 -nss-util-3.36.0-1.54.amzn1.x86_64 +nss-softokn-3.44.0-8.44.amzn1.x86_64 +nss-softokn-freebl-3.44.0-8.44.amzn1.x86_64 +nss-sysinit-3.44.0-7.84.amzn1.x86_64 +nss-tools-3.44.0-7.84.amzn1.x86_64 +nss-util-3.44.0-4.56.amzn1.x86_64 openldap-2.4.40-16.31.amzn1.x86_64 -openssl-1.0.2k-16.150.amzn1.x86_64 +openssl-1.0.2k-16.151.amzn1.x86_64 p11-kit-0.18.5-2.3.amzn1.x86_64 p11-kit-trust-0.18.5-2.3.amzn1.x86_64 pcre-8.21-7.8.amzn1.x86_64 @@ -70,21 +70,21 @@ pinentry-0.7.6-6.11.amzn1.x86_64 pkgconfig-0.27.1-2.7.amzn1.x86_64 popt-1.13-7.7.amzn1.x86_64 pth-2.0.7-9.3.7.amzn1.x86_64 -python27-2.7.16-1.131.amzn1.x86_64 +python27-2.7.18-2.140.amzn1.x86_64 python27-chardet-2.0.1-7.7.amzn1.noarch python27-iniparse-0.3.1-2.1.9.amzn1.noarch python27-kitchen-1.1.1-5.6.amzn1.noarch -python27-libs-2.7.16-1.131.amzn1.x86_64 +python27-libs-2.7.18-2.140.amzn1.x86_64 python27-pycurl-7.19.0-17.12.amzn1.x86_64 python27-pygpgme-0.3-9.12.amzn1.x86_64 python27-pyliblzma-0.5.3-11.6.amzn1.x86_64 python27-pyxattr-0.5.0-1.6.amzn1.x86_64 python27-urlgrabber-3.10-8.16.amzn1.noarch readline-6.2-9.14.amzn1.x86_64 -rpm-4.11.3-40.76.amzn1.x86_64 -rpm-build-libs-4.11.3-40.76.amzn1.x86_64 -rpm-libs-4.11.3-40.76.amzn1.x86_64 -rpm-python27-4.11.3-40.76.amzn1.x86_64 +rpm-4.11.3-40.78.amzn1.x86_64 +rpm-build-libs-4.11.3-40.78.amzn1.x86_64 +rpm-libs-4.11.3-40.78.amzn1.x86_64 +rpm-python27-4.11.3-40.78.amzn1.x86_64 sed-4.2.1-10.10.amzn1.x86_64 setup-2.8.14-20.12.amzn1.noarch shared-mime-info-1.1-9.8.amzn1.x86_64 @@ -92,9 +92,9 @@ sqlite-3.7.17-8.14.amzn1.x86_64 sysctl-defaults-1.0-1.1.amzn1.noarch system-release-2018.03-0.0.noarch tar-1.26-31.22.amzn1.x86_64 -tzdata-2019c-1.73.amzn1.noarch +tzdata-2020a-1.75.amzn1.noarch xz-libs-5.2.2-1.13.amzn1.x86_64 -yum-3.4.3-150.70.amzn1.noarch +yum-3.4.3-150.71.amzn1.noarch yum-metadata-parser-1.1.4-10.20.amzn1.x86_64 yum-plugin-ovl-1.1.31-46.30.amzn1.noarch yum-plugin-priorities-1.1.31-46.30.amzn1.noarch diff --git a/base/base-2/Dockerfile b/base/base-2/Dockerfile index 12b79b22..6f41cc31 100644 --- a/base/base-2/Dockerfile +++ b/base/base-2/Dockerfile @@ -1,9 +1,17 @@ -FROM scratch +FROM amazonlinux:2 # Docker doesn't support unpacking from remote URLs with ADD, # and we don't want to 'docker import' because we can't squash into a small layer # So this is expected to be downloaded from https://lambci.s3.amazonaws.com/fs/base-2.tgz -ADD ./base-2.tgz / +ADD ./base-2.tgz /opt/ + +RUN yum --installroot=/opt reinstall -y filesystem-3.2-25.amzn2.0.4 \ + setup-2.8.71-10.amzn2.0.1 glibc-2.26-39.amzn2 glibc-common-2.26-39.amzn2 && \ + yum --installroot=/opt clean all + +FROM scratch + +COPY --from=0 /opt / ENV PATH=/usr/local/bin:/usr/bin/:/bin:/opt/bin \ LD_LIBRARY_PATH=/lib64:/usr/lib64:/var/runtime:/var/runtime/lib:/var/task:/var/task/lib:/opt/lib \ @@ -23,11 +31,7 @@ ENV PATH=/usr/local/bin:/usr/bin/:/bin:/opt/bin \ AWS_XRAY_CONTEXT_MISSING=LOG_ERROR \ _X_AMZN_TRACE_ID='Root=1-dc99d00f-c079a84d433534434534ef0d;Parent=91ed514f1e5c03b2;Sampled=1' -RUN rm -rf /var/cache/yum /var/lib/rpm/__db.* && \ - > /var/log/yum.log && \ - mkdir -p /root /tmp && \ - chmod 550 /root && \ - chown sbx_user1051:495 /tmp && \ +RUN chown sbx_user1051:495 /tmp && \ chmod 700 /tmp WORKDIR /var/task diff --git a/base/base-2/amazonlinux2.txt b/base/base-2/amazonlinux2.txt index 9519274b..39e195e2 100644 --- a/base/base-2/amazonlinux2.txt +++ b/base/base-2/amazonlinux2.txt @@ -1,28 +1,28 @@ -amazon-linux-extras-1.6.9-2.amzn2.noarch +amazon-linux-extras-1.6.12-1.amzn2.noarch basesystem-10.0-7.amzn2.0.1.noarch -bash-4.2.46-33.amzn2.x86_64 +bash-4.2.46-34.amzn2.x86_64 bzip2-libs-1.0.6-13.amzn2.0.2.x86_64 -ca-certificates-2019.2.32-76.amzn2.0.1.noarch +ca-certificates-2019.2.32-76.amzn2.0.3.noarch chkconfig-1.7.4-1.amzn2.0.2.x86_64 coreutils-8.22-24.amzn2.x86_64 -cpio-2.11-27.amzn2.x86_64 -curl-7.61.1-12.amzn2.0.1.x86_64 +cpio-2.11-28.amzn2.x86_64 +curl-7.61.1-12.amzn2.0.2.x86_64 cyrus-sasl-lib-2.1.26-23.amzn2.x86_64 diffutils-3.3-5.amzn2.x86_64 elfutils-libelf-0.176-2.amzn2.x86_64 -expat-2.1.0-10.amzn2.0.2.x86_64 -file-libs-5.11-35.amzn2.0.2.x86_64 +expat-2.1.0-12.amzn2.x86_64 +file-libs-5.11-36.amzn2.0.1.x86_64 filesystem-3.2-25.amzn2.0.4.x86_64 -findutils-4.5.11-5.amzn2.0.2.x86_64 +findutils-4.5.11-6.amzn2.x86_64 gawk-4.0.2-4.amzn2.1.2.x86_64 gdbm-1.13-6.amzn2.0.2.x86_64 -glib2-2.56.1-4.amzn2.x86_64 -glibc-2.26-34.amzn2.x86_64 -glibc-common-2.26-34.amzn2.x86_64 -glibc-langpack-en-2.26-34.amzn2.x86_64 -glibc-minimal-langpack-2.26-34.amzn2.x86_64 +glib2-2.56.1-7.amzn2.0.1.x86_64 +glibc-2.26-38.amzn2.x86_64 +glibc-common-2.26-38.amzn2.x86_64 +glibc-langpack-en-2.26-38.amzn2.x86_64 +glibc-minimal-langpack-2.26-38.amzn2.x86_64 gmp-6.0.0-15.amzn2.0.2.x86_64 -gnupg2-2.0.22-5.amzn2.0.3.x86_64 +gnupg2-2.0.22-5.amzn2.0.4.x86_64 gpgme-1.3.2-5.amzn2.0.2.x86_64 grep-2.20-3.amzn2.0.2.x86_64 info-5.1-5.amzn2.x86_64 @@ -33,71 +33,71 @@ libassuan-2.1.0-3.amzn2.0.2.x86_64 libattr-2.4.46-12.amzn2.0.2.x86_64 libblkid-2.30.2-2.amzn2.0.4.x86_64 libcap-2.22-9.amzn2.0.2.x86_64 -libcom_err-1.42.9-12.amzn2.0.2.x86_64 -libcrypt-2.26-34.amzn2.x86_64 -libcurl-7.61.1-12.amzn2.0.1.x86_64 +libcom_err-1.42.9-19.amzn2.x86_64 +libcrypt-2.26-38.amzn2.x86_64 +libcurl-7.61.1-12.amzn2.0.2.x86_64 libdb-5.3.21-24.amzn2.0.3.x86_64 libdb-utils-5.3.21-24.amzn2.0.3.x86_64 libffi-3.0.13-18.amzn2.0.2.x86_64 -libgcc-7.3.1-6.amzn2.0.4.x86_64 +libgcc-7.3.1-9.amzn2.x86_64 libgcrypt-1.5.3-14.amzn2.0.2.x86_64 libgpg-error-1.12-3.amzn2.0.3.x86_64 libidn2-2.3.0-1.amzn2.x86_64 -libmetalink-0.1.2-7.amzn2.0.2.x86_64 +libmetalink-0.1.3-13.amzn2.x86_64 libmount-2.30.2-2.amzn2.0.4.x86_64 -libnghttp2-1.39.2-1.amzn2.x86_64 +libnghttp2-1.41.0-1.amzn2.x86_64 libselinux-2.5-12.amzn2.0.2.x86_64 libsepol-2.5-8.1.amzn2.0.2.x86_64 -libssh2-1.4.3-12.amzn2.2.2.x86_64 -libstdc++-7.3.1-6.amzn2.0.4.x86_64 +libssh2-1.4.3-12.amzn2.2.3.x86_64 +libstdc++-7.3.1-9.amzn2.x86_64 libtasn1-4.10-1.amzn2.0.2.x86_64 libunistring-0.9.3-9.amzn2.0.2.x86_64 libuuid-2.30.2-2.amzn2.0.4.x86_64 libverto-0.2.5-4.amzn2.0.2.x86_64 -libxml2-2.9.1-6.amzn2.3.3.x86_64 +libxml2-2.9.1-6.amzn2.5.1.x86_64 lua-5.1.4-15.amzn2.0.2.x86_64 ncurses-6.0-8.20170212.amzn2.1.3.x86_64 ncurses-base-6.0-8.20170212.amzn2.1.3.noarch ncurses-libs-6.0-8.20170212.amzn2.1.3.x86_64 -nspr-4.21.0-1.amzn2.0.2.x86_64 -nss-3.44.0-7.amzn2.x86_64 +nspr-4.25.0-2.amzn2.x86_64 +nss-3.53.1-3.amzn2.x86_64 nss-pem-1.0.3-5.amzn2.x86_64 -nss-softokn-3.44.0-8.amzn2.x86_64 -nss-softokn-freebl-3.44.0-8.amzn2.x86_64 -nss-sysinit-3.44.0-7.amzn2.x86_64 -nss-tools-3.44.0-7.amzn2.x86_64 -nss-util-3.44.0-4.amzn2.x86_64 -openldap-2.4.44-15.amzn2.x86_64 -openssl-libs-1.0.2k-19.amzn2.0.1.x86_64 -p11-kit-0.23.5-3.amzn2.0.2.x86_64 -p11-kit-trust-0.23.5-3.amzn2.0.2.x86_64 +nss-softokn-3.53.1-6.amzn2.x86_64 +nss-softokn-freebl-3.53.1-6.amzn2.x86_64 +nss-sysinit-3.53.1-3.amzn2.x86_64 +nss-tools-3.53.1-3.amzn2.x86_64 +nss-util-3.53.1-1.amzn2.x86_64 +openldap-2.4.44-22.amzn2.x86_64 +openssl-libs-1.0.2k-19.amzn2.0.3.x86_64 +p11-kit-0.23.21-2.amzn2.0.1.x86_64 +p11-kit-trust-0.23.21-2.amzn2.0.1.x86_64 pcre-8.32-17.amzn2.0.2.x86_64 pinentry-0.8.1-17.amzn2.0.2.x86_64 popt-1.13-16.amzn2.0.2.x86_64 pth-2.0.7-23.amzn2.0.2.x86_64 pygpgme-0.3-9.amzn2.0.2.x86_64 pyliblzma-0.5.3-11.amzn2.0.2.x86_64 -python-2.7.16-5.amzn2.x86_64 +python-2.7.18-1.amzn2.0.2.x86_64 python-iniparse-0.4-9.amzn2.noarch -python-libs-2.7.16-5.amzn2.x86_64 +python-libs-2.7.18-1.amzn2.0.2.x86_64 python-pycurl-7.19.0-19.amzn2.0.2.x86_64 python-urlgrabber-3.10-9.amzn2.0.1.noarch -python2-rpm-4.11.3-40.amzn2.0.3.x86_64 +python2-rpm-4.11.3-40.amzn2.0.5.x86_64 pyxattr-0.5.1-5.amzn2.0.2.x86_64 readline-6.2-10.amzn2.0.2.x86_64 -rpm-4.11.3-40.amzn2.0.3.x86_64 -rpm-build-libs-4.11.3-40.amzn2.0.3.x86_64 -rpm-libs-4.11.3-40.amzn2.0.3.x86_64 +rpm-4.11.3-40.amzn2.0.5.x86_64 +rpm-build-libs-4.11.3-40.amzn2.0.5.x86_64 +rpm-libs-4.11.3-40.amzn2.0.5.x86_64 sed-4.2.2-5.amzn2.0.2.x86_64 -setup-2.8.71-10.amzn2.noarch +setup-2.8.71-10.amzn2.0.1.noarch shared-mime-info-1.8-4.amzn2.x86_64 -sqlite-3.7.17-8.amzn2.0.2.x86_64 -system-release-2-11.amzn2.x86_64 -tzdata-2019c-1.amzn2.noarch +sqlite-3.7.17-8.amzn2.1.1.x86_64 +system-release-2-12.amzn2.x86_64 +tzdata-2020a-1.amzn2.noarch vim-minimal-8.1.1602-1.amzn2.x86_64 xz-libs-5.2.2-1.amzn2.0.2.x86_64 -yum-3.4.3-158.amzn2.0.3.noarch +yum-3.4.3-158.amzn2.0.4.noarch yum-metadata-parser-1.1.4-10.amzn2.0.2.x86_64 yum-plugin-ovl-1.1.31-46.amzn2.0.1.noarch yum-plugin-priorities-1.1.31-46.amzn2.0.1.noarch -zlib-1.2.7-17.amzn2.0.2.x86_64 +zlib-1.2.7-18.amzn2.x86_64 diff --git a/base/base-2/diff.txt b/base/base-2/diff.txt index cb9feacb..02234165 100644 --- a/base/base-2/diff.txt +++ b/base/base-2/diff.txt @@ -1,27 +1,27 @@ -amazon-linux-extras-1.6.9-2.amzn2.noarch +amazon-linux-extras-1.6.11-1.amzn2.noarch bzip2-libs-1.0.6-13.amzn2.0.2.x86_64 cpio-2.11-27.amzn2.x86_64 curl-7.61.1-12.amzn2.0.1.x86_64 cyrus-sasl-lib-2.1.26-23.amzn2.x86_64 -diffutils-3.3-4.amzn2.0.2.x86_64 +diffutils-3.3-5.amzn2.x86_64 elfutils-libelf-0.176-2.amzn2.x86_64 expat-2.1.0-10.amzn2.0.2.x86_64 -file-libs-5.11-33.amzn2.0.2.x86_64 -findutils-4.5.11-5.amzn2.0.2.x86_64 +file-libs-5.11-35.amzn2.0.2.x86_64 +findutils-4.5.11-6.amzn2.x86_64 gdbm-1.13-6.amzn2.0.2.x86_64 -glib2-2.56.1-4.amzn2.x86_64 -glibc-langpack-en-2.26-32.amzn2.0.2.x86_64 -gnupg2-2.0.22-5.amzn2.0.3.x86_64 +glib2-2.56.1-5.amzn2.0.1.x86_64 +glibc-langpack-en-2.26-34.amzn2.x86_64 +gnupg2-2.0.22-5.amzn2.0.4.x86_64 gpgme-1.3.2-5.amzn2.0.2.x86_64 libassuan-2.1.0-3.amzn2.0.2.x86_64 libblkid-2.30.2-2.amzn2.0.4.x86_64 -libcrypt-2.26-32.amzn2.0.2.x86_64 +libcrypt-2.26-34.amzn2.x86_64 libcurl-7.61.1-12.amzn2.0.1.x86_64 libdb-5.3.21-24.amzn2.0.3.x86_64 libdb-utils-5.3.21-24.amzn2.0.3.x86_64 libgcrypt-1.5.3-14.amzn2.0.2.x86_64 libgpg-error-1.12-3.amzn2.0.3.x86_64 -libidn2-2.0.4-1.amzn2.0.2.x86_64 +libidn2-2.3.0-1.amzn2.x86_64 libmetalink-0.1.2-7.amzn2.0.2.x86_64 libmount-2.30.2-2.amzn2.0.4.x86_64 libnghttp2-1.39.2-1.amzn2.x86_64 @@ -30,32 +30,32 @@ libunistring-0.9.3-9.amzn2.0.2.x86_64 libuuid-2.30.2-2.amzn2.0.4.x86_64 libxml2-2.9.1-6.amzn2.3.3.x86_64 lua-5.1.4-15.amzn2.0.2.x86_64 -nss-3.44.0-4.amzn2.0.2.x86_64 +nss-3.44.0-7.amzn2.x86_64 nss-pem-1.0.3-5.amzn2.x86_64 -nss-softokn-3.44.0-5.amzn2.0.2.x86_64 -nss-sysinit-3.44.0-4.amzn2.0.2.x86_64 -nss-tools-3.44.0-4.amzn2.0.2.x86_64 +nss-softokn-3.44.0-8.amzn2.x86_64 +nss-sysinit-3.44.0-7.amzn2.x86_64 +nss-tools-3.44.0-7.amzn2.x86_64 openldap-2.4.44-15.amzn2.x86_64 pinentry-0.8.1-17.amzn2.0.2.x86_64 pth-2.0.7-23.amzn2.0.2.x86_64 pygpgme-0.3-9.amzn2.0.2.x86_64 pyliblzma-0.5.3-11.amzn2.0.2.x86_64 -python-2.7.16-3.amzn2.0.1.x86_64 +python-2.7.18-1.amzn2.x86_64 python-iniparse-0.4-9.amzn2.noarch -python-libs-2.7.16-3.amzn2.0.1.x86_64 +python-libs-2.7.18-1.amzn2.x86_64 python-pycurl-7.19.0-19.amzn2.0.2.x86_64 -python-urlgrabber-3.10-8.amzn2.noarch +python-urlgrabber-3.10-9.amzn2.0.1.noarch +python2-rpm-4.11.3-40.amzn2.0.4.x86_64 pyxattr-0.5.1-5.amzn2.0.2.x86_64 readline-6.2-10.amzn2.0.2.x86_64 -rpm-4.11.3-25.amzn2.0.3.x86_64 -rpm-build-libs-4.11.3-25.amzn2.0.3.x86_64 -rpm-libs-4.11.3-25.amzn2.0.3.x86_64 -rpm-python-4.11.3-25.amzn2.0.3.x86_64 +rpm-4.11.3-40.amzn2.0.4.x86_64 +rpm-build-libs-4.11.3-40.amzn2.0.4.x86_64 +rpm-libs-4.11.3-40.amzn2.0.4.x86_64 shared-mime-info-1.8-4.amzn2.x86_64 -sqlite-3.7.17-8.amzn2.0.2.x86_64 +sqlite-3.7.17-8.amzn2.1.1.x86_64 vim-minimal-8.1.1602-1.amzn2.x86_64 xz-libs-5.2.2-1.amzn2.0.2.x86_64 -yum-3.4.3-158.amzn2.0.2.noarch +yum-3.4.3-158.amzn2.0.4.noarch yum-metadata-parser-1.1.4-10.amzn2.0.2.x86_64 yum-plugin-ovl-1.1.31-46.amzn2.0.1.noarch yum-plugin-priorities-1.1.31-46.amzn2.0.1.noarch diff --git a/base/base-2/packages.txt b/base/base-2/packages.txt index 81a1640c..88d114d4 100644 --- a/base/base-2/packages.txt +++ b/base/base-2/packages.txt @@ -1,44 +1,44 @@ basesystem-10.0-7.amzn2.0.1.noarch -bash-4.2.46-30.amzn2.x86_64 -ca-certificates-2019.2.32-76.amzn2.0.1.noarch +bash-4.2.46-34.amzn2.x86_64 +ca-certificates-2019.2.32-76.amzn2.0.3.noarch chkconfig-1.7.4-1.amzn2.0.2.x86_64 -coreutils-8.22-21.amzn2.x86_64 +coreutils-8.22-24.amzn2.x86_64 filesystem-3.2-25.amzn2.0.4.x86_64 gawk-4.0.2-4.amzn2.1.2.x86_64 -glibc-2.26-34.amzn2.x86_64 -glibc-all-langpacks-2.26-34.amzn2.x86_64 -glibc-common-2.26-34.amzn2.x86_64 -glibc-minimal-langpack-2.26-34.amzn2.x86_64 +glibc-2.26-38.amzn2.x86_64 +glibc-all-langpacks-2.26-38.amzn2.x86_64 +glibc-common-2.26-38.amzn2.x86_64 +glibc-minimal-langpack-2.26-38.amzn2.x86_64 gmp-6.0.0-15.amzn2.0.2.x86_64 grep-2.20-3.amzn2.0.2.x86_64 info-5.1-5.amzn2.x86_64 keyutils-libs-1.5.8-3.amzn2.0.2.x86_64 -krb5-libs-1.15.1-37.amzn2.2.1.x86_64 +krb5-libs-1.15.1-37.amzn2.2.2.x86_64 libacl-2.2.51-14.amzn2.x86_64 libattr-2.4.46-12.amzn2.0.2.x86_64 libcap-2.22-9.amzn2.0.2.x86_64 -libcom_err-1.42.9-12.amzn2.0.2.x86_64 +libcom_err-1.42.9-19.amzn2.x86_64 libffi-3.0.13-18.amzn2.0.2.x86_64 -libgcc-7.3.1-6.amzn2.0.4.x86_64 -libicu-50.1.2-17.amzn2.x86_64 +libgcc-7.3.1-9.amzn2.x86_64 +libicu-50.2-4.amzn2.x86_64 libselinux-2.5-12.amzn2.0.2.x86_64 libsepol-2.5-8.1.amzn2.0.2.x86_64 -libstdc++-7.3.1-6.amzn2.0.4.x86_64 +libstdc++-7.3.1-9.amzn2.x86_64 libtasn1-4.10-1.amzn2.0.2.x86_64 libverto-0.2.5-4.amzn2.0.2.x86_64 ncurses-6.0-8.20170212.amzn2.1.3.x86_64 ncurses-base-6.0-8.20170212.amzn2.1.3.noarch ncurses-libs-6.0-8.20170212.amzn2.1.3.x86_64 -nspr-4.21.0-1.amzn2.0.2.x86_64 -nss-softokn-freebl-3.44.0-8.amzn2.x86_64 -nss-util-3.44.0-4.amzn2.x86_64 -openssl-libs-1.0.2k-19.amzn2.0.1.x86_64 -p11-kit-0.23.5-3.amzn2.0.2.x86_64 -p11-kit-trust-0.23.5-3.amzn2.0.2.x86_64 +nspr-4.25.0-2.amzn2.x86_64 +nss-softokn-freebl-3.53.1-6.amzn2.x86_64 +nss-util-3.53.1-1.amzn2.x86_64 +openssl-libs-1.0.2k-19.amzn2.0.3.x86_64 +p11-kit-0.23.21-2.amzn2.0.1.x86_64 +p11-kit-trust-0.23.21-2.amzn2.0.1.x86_64 pcre-8.32-17.amzn2.0.2.x86_64 popt-1.13-16.amzn2.0.2.x86_64 sed-4.2.2-5.amzn2.0.2.x86_64 -setup-2.8.71-10.amzn2.noarch -system-release-2-11.amzn2.x86_64 -tzdata-2019c-1.amzn2.noarch -zlib-1.2.7-17.amzn2.0.2.x86_64 +setup-2.8.71-10.amzn2.0.1.noarch +system-release-2-12.amzn2.x86_64 +tzdata-2020a-1.amzn2.noarch +zlib-1.2.7-18.amzn2.x86_64 diff --git a/base/build-2/Dockerfile b/base/build-2/Dockerfile index a0d07fbd..104c9db7 100644 --- a/base/build-2/Dockerfile +++ b/base/build-2/Dockerfile @@ -1,21 +1,25 @@ +FROM lambci/lambda-base-2 + FROM amazonlinux:2 -RUN yum list yum && \ - yum install -y --releasever=2 --installroot=/installroot yum yum-plugin-ovl yum-plugin-priorities +COPY --from=0 / /opt/ +RUN yum --installroot=/opt install -y yum yum-plugin-ovl yum-plugin-priorities FROM lambci/lambda-base-2 -ENV PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin +ENV PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin \ + PIPX_BIN_DIR=/usr/local/bin \ + PIPX_HOME=/usr/local/pipx -COPY --from=0 /installroot/etc /etc/ -COPY --from=0 /installroot/usr /usr/ +COPY --from=1 /opt / -RUN yum reinstall -y filesystem setup glibc-common glibc; \ +RUN chown root:root /tmp && \ + chmod 1777 /tmp && \ yum install -y glibc-langpack-en && \ yum groupinstall -y development && \ yum install -y which clang cmake python-devel python3-devel amazon-linux-extras && \ amazon-linux-extras install -y docker && \ - pip3 install -U pip setuptools wheel --no-cache-dir && \ yum clean all && \ - rm -rf /var/cache/yum + pip3 install -U pip setuptools wheel --no-cache-dir && \ + pip3 install pipx --no-cache-dir diff --git a/base/build-all-build.sh b/base/build-all-build.sh new file mode 100755 index 00000000..d5b958be --- /dev/null +++ b/base/build-all-build.sh @@ -0,0 +1,14 @@ +#!/bin/bash +set -e + +source ${PWD}/runtimes.sh + +TOP_DIR="${PWD}/.." + +for RUNTIME in $RUNTIMES; do + echo build-${RUNTIME} + + cd ${TOP_DIR}/${RUNTIME}/build + + docker build -t lambci/lambda:build-${RUNTIME} . +done diff --git a/base/build-all-run.sh b/base/build-all-run.sh new file mode 100755 index 00000000..27abcaab --- /dev/null +++ b/base/build-all-run.sh @@ -0,0 +1,16 @@ +#!/bin/bash +set -e + +source ${PWD}/runtimes.sh + +TOP_DIR="${PWD}/.." + +for RUNTIME in $RUNTIMES; do + echo $RUNTIME + + cd ${TOP_DIR}/${RUNTIME}/run + + [ -x ./update_libs.sh ] && ./update_libs.sh + + docker build --no-cache -t lambci/lambda:${RUNTIME} . +done diff --git a/base/build-all.sh b/base/build-all.sh index 88ad7919..aeb952d8 100755 --- a/base/build-all.sh +++ b/base/build-all.sh @@ -1,23 +1,6 @@ #!/bin/bash +set -e -RUNTIMES="provided go1.x nodejs4.3 nodejs6.10 nodejs8.10 python2.7 python3.6 python3.7 ruby2.5 java8 dotnetcore2.0 dotnetcore2.1 nodejs10.x nodejs12.x python3.8 ruby2.7 java11 dotnetcore3.1" +${PWD}/build-all-run.sh -TOP_DIR="${PWD}/.." - -for RUNTIME in $RUNTIMES; do - echo $RUNTIME - - cd ${TOP_DIR}/${RUNTIME}/run - - [ -x ./update_libs.sh ] && ./update_libs.sh - - docker build --no-cache -t lambci/lambda:${RUNTIME} . -done - -for RUNTIME in $RUNTIMES; do - echo build-${RUNTIME} - - cd ${TOP_DIR}/${RUNTIME}/build - - docker build -t lambci/lambda:build-${RUNTIME} . -done +${PWD}/build-all-build.sh diff --git a/base/build/Dockerfile b/base/build/Dockerfile index 99fa4bc2..3a61529f 100644 --- a/base/build/Dockerfile +++ b/base/build/Dockerfile @@ -1,28 +1,20 @@ FROM lambci/lambda-base -ENV PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin +ENV PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin \ + PIPX_BIN_DIR=/usr/local/bin \ + PIPX_HOME=/usr/local/pipx -# A couple of packages are either missing critical-ish files, or didn't make it into the tar -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 install -y yum-plugin-ovl && \ - yum reinstall -y setup pam shadow-utils audit-libs openssl glibc-common glibc && \ +RUN chown root:root /tmp && \ + chmod 1777 /tmp && \ + yum groups mark convert && \ yum groupinstall -y development && \ yum install -y clang cmake docker python27-devel python36-devel \ - ImageMagick-devel-6.7.8.9 cairo-devel libssh2-devel libxslt-devel libmpc-devel readline-devel db4-devel \ + ImageMagick-devel-6.9.10.68 cairo-devel libssh2-devel libxslt-devel libmpc-devel readline-devel db4-devel \ libffi-devel expat-devel libicu-devel lua-devel gdbm-devel sqlite-devel pcre-devel libcurl-devel && \ + yum clean all && \ alternatives --set gcc /usr/bin/gcc48 && \ alternatives --set g++ /usr/bin/g++48 && \ alternatives --set cpp /usr/bin/cpp48 && \ - curl --silent --show-error --retry 5 https://bootstrap.pypa.io/get-pip.py | python3 && \ - pip install -U setuptools wheel --no-cache-dir && \ - yum clean all && \ - rm -rf /var/cache/yum + python3 -m pip install -U pip setuptools wheel --no-cache-dir && \ + pip install pipx --no-cache-dir && \ + pipx run awscli==1.* 2>/dev/null || true diff --git a/base/dump-go1x/go.mod b/base/dump-go1x/go.mod index 54262d7d..1dccccbe 100644 --- a/base/dump-go1x/go.mod +++ b/base/dump-go1x/go.mod @@ -5,4 +5,4 @@ require ( github.com/aws/aws-sdk-go-v2 v0.17.0 ) -go 1.14 +go 1.15 diff --git a/base/dump-java11/.project b/base/dump-java11/.project index 47ed2d4d..52873e92 100644 --- a/base/dump-java11/.project +++ b/base/dump-java11/.project @@ -20,4 +20,15 @@ org.eclipse.jdt.core.javanature org.eclipse.buildship.core.gradleprojectnature + + + 1599680497019 + + 30 + + org.eclipse.core.resources.regexFilterMatcher + node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ + + + diff --git a/base/dump-java8/.project b/base/dump-java8/.project index 0e30deb7..848abc21 100644 --- a/base/dump-java8/.project +++ b/base/dump-java8/.project @@ -1,23 +1,34 @@ - dump-java8 - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.buildship.core.gradleprojectbuilder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.buildship.core.gradleprojectnature - + dump-java8 + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.buildship.core.gradleprojectbuilder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.buildship.core.gradleprojectnature + + + + 1599680497033 + + 30 + + org.eclipse.core.resources.regexFilterMatcher + node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ + + + diff --git a/base/dump-java8/.settings/org.eclipse.buildship.core.prefs b/base/dump-java8/.settings/org.eclipse.buildship.core.prefs index 39c6821c..90865998 100644 --- a/base/dump-java8/.settings/org.eclipse.buildship.core.prefs +++ b/base/dump-java8/.settings/org.eclipse.buildship.core.prefs @@ -1,7 +1,7 @@ arguments= auto.sync=false build.scans.enabled=false -connection.gradle.distribution=GRADLE_DISTRIBUTION(VERSION(6.0-20191016123526+0000)) +connection.gradle.distribution=GRADLE_DISTRIBUTION(VERSION(6.3)) connection.project.dir= eclipse.preferences.version=1 gradle.user.home= diff --git a/base/dump-java8al2/.classpath b/base/dump-java8al2/.classpath new file mode 100644 index 00000000..4857be40 --- /dev/null +++ b/base/dump-java8al2/.classpath @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/base/dump-java8al2/.project b/base/dump-java8al2/.project new file mode 100644 index 00000000..b3dcbd7f --- /dev/null +++ b/base/dump-java8al2/.project @@ -0,0 +1,34 @@ + + + dump-java8 + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.buildship.core.gradleprojectbuilder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.buildship.core.gradleprojectnature + + + + 1599680497040 + + 30 + + org.eclipse.core.resources.regexFilterMatcher + node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ + + + + diff --git a/base/dump-java8al2/.settings/org.eclipse.buildship.core.prefs b/base/dump-java8al2/.settings/org.eclipse.buildship.core.prefs new file mode 100644 index 00000000..90865998 --- /dev/null +++ b/base/dump-java8al2/.settings/org.eclipse.buildship.core.prefs @@ -0,0 +1,13 @@ +arguments= +auto.sync=false +build.scans.enabled=false +connection.gradle.distribution=GRADLE_DISTRIBUTION(VERSION(6.3)) +connection.project.dir= +eclipse.preferences.version=1 +gradle.user.home= +java.home= +jvm.arguments= +offline.mode=false +override.workspace.settings=true +show.console.view=true +show.executions.view=true diff --git a/base/dump-java8al2/.settings/org.eclipse.core.resources.prefs b/base/dump-java8al2/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 00000000..2b763404 --- /dev/null +++ b/base/dump-java8al2/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding//src/main/java=UTF-8 diff --git a/base/dump-java8al2/.settings/org.eclipse.jdt.core.prefs b/base/dump-java8al2/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000..2f5cc74c --- /dev/null +++ b/base/dump-java8al2/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore +org.eclipse.jdt.core.compiler.release=disabled +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/base/dump-java8al2/build.gradle b/base/dump-java8al2/build.gradle new file mode 100644 index 00000000..77e5fb16 --- /dev/null +++ b/base/dump-java8al2/build.gradle @@ -0,0 +1,28 @@ +apply plugin: 'java' + +sourceCompatibility = '1.8' +targetCompatibility = '1.8' + +repositories { + mavenCentral() +} + +dependencies { + implementation ( + 'com.amazonaws:aws-lambda-java-core:1.2.0', + 'com.amazonaws:aws-lambda-java-events:2.2.7', + 'com.amazonaws:aws-java-sdk-s3:1.11.681' + ) +} + +task buildZip(type: Zip) { + from compileJava + from processResources + into('lib') { + from configurations.runtimeClasspath + } +} + +build.dependsOn buildZip + +// docker run --rm -v "$PWD":/app -w /app gradle:jdk8 gradle build diff --git a/base/dump-java8al2/src/main/java/org/lambci/lambda/DumpJava8.java b/base/dump-java8al2/src/main/java/org/lambci/lambda/DumpJava8.java new file mode 100644 index 00000000..f842aa4a --- /dev/null +++ b/base/dump-java8al2/src/main/java/org/lambci/lambda/DumpJava8.java @@ -0,0 +1,88 @@ +package org.lambci.lambda; + +import java.io.File; +import java.io.IOException; +import java.lang.InterruptedException; +import java.lang.management.ManagementFactory; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.Map; +import java.util.Scanner; + +import com.amazonaws.services.lambda.runtime.Context; +import com.amazonaws.services.lambda.runtime.RequestHandler; +import com.amazonaws.services.s3.AmazonS3; +import com.amazonaws.services.s3.AmazonS3ClientBuilder; +import com.amazonaws.services.s3.model.CannedAccessControlList; +import com.amazonaws.services.s3.model.PutObjectRequest; +import com.amazonaws.services.s3.model.PutObjectResult; + +public class DumpJava8 implements RequestHandler { + + @Override + public PutObjectResult handleRequest(Object input, Context context) { + String filename = "java8.al2.tgz"; + String cmd = "tar -cpzf /tmp/" + filename + " --numeric-owner --ignore-failed-read /var/runtime /var/lang"; + AmazonS3 s3client = AmazonS3ClientBuilder.standard().withRegion("us-east-1").build(); + + System.out.println(ManagementFactory.getRuntimeMXBean().getInputArguments().toString()); + System.out.println(System.getProperty("sun.java.command")); + System.out.println(System.getProperty("java.home")); + System.out.println(System.getProperty("java.library.path")); + System.out.println(System.getProperty("java.class.path")); + System.out.println(System.getProperty("user.dir")); + System.out.println(System.getProperty("user.home")); + System.out.println(System.getProperty("user.name")); + System.out.println(new File(".").getAbsolutePath()); + Map env = System.getenv(); + for (String envName : env.keySet()) { + System.out.println(envName + "=" + env.get(envName)); + } + + try { + int pid = Integer.parseInt(new File("/proc/self").getCanonicalFile().getName()); + + System.out.println("Parent cmdline:"); + System.out.println(new String(Files.readAllBytes(Paths.get("/proc/1/cmdline"))).replace("\0", " ")); + + System.out.println("Parent env:"); + runShell("xargs --null --max-args=1 < /proc/1/environ"); + + System.out.println("This cmdline:"); + System.out.println(new String(Files.readAllBytes(Paths.get("/proc/" + pid + "/cmdline"))).replace("\0", " ")); + + System.out.println("This env:"); + runShell("xargs --null --max-args=1 < /proc/" + pid + "/environ"); + + if (runShell(cmd) != 0) { + return null; + } + + System.out.println("Zipping done! Uploading..."); + + return s3client.putObject(new PutObjectRequest("lambci", "fs/" + filename, new File("/tmp/" + filename)) + .withCannedAcl(CannedAccessControlList.PublicRead)); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public static int runShell(String cmd) throws IOException, InterruptedException { + Process process = Runtime.getRuntime().exec(new String[] { "sh", "-c", cmd }); + + try (Scanner stdoutScanner = new Scanner(process.getInputStream()); + Scanner stderrScanner = new Scanner(process.getErrorStream())) { + // Echo all stdout first + while (stdoutScanner.hasNextLine()) { + System.out.println(stdoutScanner.nextLine()); + } + // Then echo stderr + while (stderrScanner.hasNextLine()) { + System.err.println(stderrScanner.nextLine()); + } + } + + process.waitFor(); + return process.exitValue(); + } +} diff --git a/base/dump-provided.sh b/base/dump-provided.sh index 690ec844..9a3472f3 100755 --- a/base/dump-provided.sh +++ b/base/dump-provided.sh @@ -6,7 +6,7 @@ export HOME=/tmp export PATH=/tmp/.local/bin:$PATH cd /tmp -curl -sSL https://bootstrap.pypa.io/get-pip.py -o get-pip.py +curl -sSL https://bootstrap.pypa.io/2.7/get-pip.py -o get-pip.py python get-pip.py --user pip install --user awscli diff --git a/base/dump-providedal2/bootstrap.go b/base/dump-providedal2/bootstrap.go new file mode 100644 index 00000000..a0f1d7b3 --- /dev/null +++ b/base/dump-providedal2/bootstrap.go @@ -0,0 +1,87 @@ +// docker run --rm -v "$PWD":/go/src/handler lambci/lambda:build-go1.x sh -c \ +// 'go mod download && go build -tags lambda.norpc -ldflags="-s -w" bootstrap.go' && \ +// zip bootstrap.zip bootstrap + +package main + +import ( + "context" + "fmt" + "io/ioutil" + "log" + "os" + "os/exec" + "strings" + + "github.com/aws/aws-lambda-go/lambda" + "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/aws/external" + "github.com/aws/aws-sdk-go-v2/service/s3" +) + +func handleRequest(ctx context.Context, event interface{}) (*s3.PutObjectResponse, error) { + filename := "provided.al2.tgz" + + runShell("tar -cpzf /tmp/" + filename + " --numeric-owner --ignore-failed-read /var/runtime /var/lang") + + fmt.Println("Zipping done! Uploading...") + + cfg, err := external.LoadDefaultAWSConfig() + if err != nil { + log.Fatal(err) + } + + file, err := os.Open("/tmp/" + filename) + if err != nil { + log.Fatal(err) + } + + resp, err := s3.New(cfg).PutObjectRequest(&s3.PutObjectInput{ + ACL: s3.ObjectCannedACLPublicRead, + Body: file, + Bucket: aws.String("lambci"), + Key: aws.String("fs/" + filename), + }).Send(context.Background()) + if err != nil { + log.Fatal(err) + } + + fmt.Println("Uploading done!") + + fmt.Println("Parent env:") + runShell("xargs --null --max-args=1 < /proc/1/environ") + + fmt.Println("Parent cmdline:") + content, err := ioutil.ReadFile("/proc/1/cmdline") + fmt.Println(strings.ReplaceAll(string(content), "\x00", " ")) + + fmt.Println("os.Args:") + for _, a := range os.Args { + fmt.Println(a) + } + + fmt.Println("os.Getwd:") + pwd, _ := os.Getwd() + fmt.Println(pwd) + + fmt.Println("os.Environ:") + for _, e := range os.Environ() { + fmt.Println(e) + } + + fmt.Println("ctx:") + fmt.Println(ctx) + + return resp, nil +} + +func runShell(shellCmd string) { + cmd := exec.Command("sh", "-c", shellCmd) + cmd.Stdout = os.Stdout + cmd.Stderr = os.Stderr + cmd.Run() +} + +func main() { + lambda.Start(handleRequest) +} diff --git a/base/dump-providedal2/go.mod b/base/dump-providedal2/go.mod new file mode 100644 index 00000000..4fc94c95 --- /dev/null +++ b/base/dump-providedal2/go.mod @@ -0,0 +1,8 @@ +module bootstrap + +require ( + github.com/aws/aws-lambda-go v1.19.0 + github.com/aws/aws-sdk-go-v2 v0.24.0 +) + +go 1.15 diff --git a/base/dump-providedal2/go.sum b/base/dump-providedal2/go.sum new file mode 100644 index 00000000..0b1fc768 --- /dev/null +++ b/base/dump-providedal2/go.sum @@ -0,0 +1,26 @@ +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/aws/aws-lambda-go v1.19.0/go.mod h1:jJmlefzPfGnckuHdXX7/80O3BvUUi12XOkbv4w9SGLU= +github.com/aws/aws-sdk-go-v2 v0.24.0/go.mod h1:2LhT7UgHOXK3UXONKI5OMgIyoQL6zTAw/jwIeX6yqzw= +github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/urfave/cli/v2 v2.2.0/go.mod h1:SE9GqnLQmjVa0iPEY0f1w3ygNIYcIJ0OKPMoW2caLfQ= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/base/dump.sh b/base/dump.sh index 608e2bae..944988d2 100755 --- a/base/dump.sh +++ b/base/dump.sh @@ -1,6 +1,6 @@ #!/bin/bash -RUNTIMES="node43 node610 node810 node10x node12x python27 python36 python37 python38 ruby25 ruby27 java8 java11 go1x dotnetcore20 dotnetcore21 dotnetcore31 provided" +source ${PWD}/runtimes.sh for RUNTIME in $RUNTIMES; do echo $RUNTIME diff --git a/base/packages.txt b/base/packages.txt index e29e8ab5..7e5e4fb1 100644 --- a/base/packages.txt +++ b/base/packages.txt @@ -1,14 +1,14 @@ -ImageMagick-6.7.8.9-15.21.amzn1.x86_64 +ImageMagick-6.9.10.68-3.22.amzn1.x86_64 alsa-lib-1.0.22-3.9.amzn1.x86_64 audit-libs-2.6.5-3.28.amzn1.x86_64 avahi-libs-0.6.25-12.17.amzn1.x86_64 basesystem-10.0-4.9.amzn1.noarch -bash-4.2.46-28.37.amzn1.x86_64 +bash-4.2.46-34.43.amzn1.x86_64 binutils-2.25.1-31.base.66.amzn1.x86_64 bzip2-1.0.6-8.12.amzn1.x86_64 bzip2-libs-1.0.6-8.12.amzn1.x86_64 -ca-certificates-2018.2.22-65.1.21.amzn1.noarch -cairo-1.12.14-6.8.amzn1.x86_64 +ca-certificates-2018.2.22-65.1.22.amzn1.noarch +cairo-1.12.14-6.9.amzn1.x86_64 chkconfig-1.3.49.3-2.14.amzn1.x86_64 compat-gmp4-4.3.2-1.14.amzn1.x86_64 copy-jdk-configs-3.3-10.3.amzn1.noarch @@ -17,7 +17,7 @@ cpio-2.10-12.12.amzn1.x86_64 cracklib-2.8.16-4.14.amzn1.x86_64 cracklib-dicts-2.8.16-4.14.amzn1.x86_64 cups-libs-1.4.2-67.21.amzn1.x86_64 -curl-7.61.1-12.93.amzn1.x86_64 +curl-7.61.1-12.95.amzn1.x86_64 cyrus-sasl-lib-2.1.23-13.16.amzn1.x86_64 db4-4.7.25-18.11.amzn1.x86_64 db4-utils-4.7.25-18.11.amzn1.x86_64 @@ -27,21 +27,21 @@ dejavu-sans-fonts-2.33-6.6.amzn1.noarch dejavu-serif-fonts-2.33-6.6.amzn1.noarch diffutils-3.3-4.15.amzn1.x86_64 elfutils-libelf-0.168-8.19.amzn1.x86_64 -expat-2.1.0-10.21.amzn1.x86_64 -file-5.37-8.48.amzn1.x86_64 -file-libs-5.37-8.48.amzn1.x86_64 +expat-2.1.0-11.22.amzn1.x86_64 +file-5.37-8.49.amzn1.x86_64 +file-libs-5.37-8.49.amzn1.x86_64 filesystem-2.4.30-3.8.amzn1.x86_64 findutils-4.4.2-6.9.amzn1.x86_64 fontconfig-2.8.0-5.8.amzn1.x86_64 fontpackages-filesystem-1.41-1.1.2.amzn1.noarch -freetype-2.3.11-15.14.amzn1.x86_64 +freetype-2.3.11-19.15.amzn1.x86_64 gawk-3.1.7-10.10.amzn1.x86_64 gdbm-1.8.0-36.6.amzn1.x86_64 ghostscript-fonts-5.50-23.2.7.amzn1.noarch giflib-4.1.6-3.1.6.amzn1.x86_64 glib2-2.36.3-5.21.amzn1.x86_64 -glibc-2.17-292.178.amzn1.x86_64 -glibc-common-2.17-292.178.amzn1.x86_64 +glibc-2.17-292.180.amzn1.x86_64 +glibc-common-2.17-292.180.amzn1.x86_64 gmp-6.0.0-11.16.amzn1.x86_64 gnupg2-2.0.28-2.33.amzn1.x86_64 gnutls-2.12.23-21.18.amzn1.x86_64 @@ -60,7 +60,7 @@ jpackage-utils-1.7.5-27.17.amzn1.noarch keyutils-libs-1.5.8-3.12.amzn1.x86_64 kmod-14-10.10.amzn1.x86_64 kmod-libs-14-10.10.amzn1.x86_64 -krb5-libs-1.15.1-34.44.amzn1.x86_64 +krb5-libs-1.15.1-46.48.amzn1.x86_64 lcms2-2.6-2.5.amzn1.x86_64 libICE-1.0.6-1.4.amzn1.x86_64 libSM-1.2.1-2.6.amzn1.x86_64 @@ -84,7 +84,7 @@ libblkid-2.23.2-59.29.amzn1.x86_64 libcap-2.16-5.5.8.amzn1.x86_64 libcap-ng-0.7.5-4.15.amzn1.x86_64 libcom_err-1.43.5-2.43.amzn1.x86_64 -libcurl-7.61.1-12.93.amzn1.x86_64 +libcurl-7.61.1-12.95.amzn1.x86_64 libdrm-2.4.82-1.14.amzn1.x86_64 libffi-3.0.13-16.5.amzn1.x86_64 libfontenc-1.0.5-2.6.amzn1.x86_64 @@ -94,11 +94,11 @@ libglvnd-0.2.999-14.20170308git8e6e102.3.amzn1.x86_64 libglvnd-glx-0.2.999-14.20170308git8e6e102.3.amzn1.x86_64 libgomp-6.4.1-1.45.amzn1.x86_64 libgpg-error-1.11-1.12.amzn1.x86_64 -libicu-50.1.2-11.12.amzn1.x86_64 +libicu-50.2-4.0.amzn1.x86_64 libidn2-2.3.0-1.4.amzn1.x86_64 libjpeg-turbo-1.2.90-8.16.amzn1.x86_64 libmount-2.23.2-59.29.amzn1.x86_64 -libnghttp2-1.31.1-2.5.amzn1.x86_64 +libnghttp2-1.33.0-1.1.6.amzn1.x86_64 libpciaccess-0.13.1-4.1.11.amzn1.x86_64 libpng-1.2.49-2.14.amzn1.x86_64 libpsl-0.6.2-1.2.amzn1.x86_64 @@ -109,7 +109,7 @@ libsmartcols-2.23.2-59.29.amzn1.x86_64 libssh2-1.4.2-3.12.amzn1.x86_64 libstdc++72-7.2.1-2.59.amzn1.x86_64 libtasn1-2.3-6.6.amzn1.x86_64 -libtiff-4.0.3-32.34.amzn1.x86_64 +libtiff-4.0.3-35.36.amzn1.x86_64 libtool-ltdl-2.4.2-20.4.8.5.32.amzn1.x86_64 libudev-173-4.13.amzn1.x86_64 libunistring-0.9.3-6.1.amzn1.x86_64 @@ -119,7 +119,7 @@ libuuid-2.23.2-59.29.amzn1.x86_64 libverto-0.2.5-4.9.amzn1.x86_64 libwmf-lite-0.2.8.4-41.13.amzn1.x86_64 libxcb-1.11-2.21.amzn1.x86_64 -libxml2-2.9.1-6.3.52.amzn1.x86_64 +libxml2-2.9.1-6.4.41.amzn1.x86_64 libxshmfence-1.2-1.4.amzn1.x86_64 libxslt-1.1.28-5.13.amzn1.x86_64 lksctp-tools-1.0.10-7.7.amzn1.x86_64 @@ -132,16 +132,16 @@ mesa-libglapi-17.1.5-2.41.amzn1.x86_64 ncurses-5.7-4.20090207.14.amzn1.x86_64 ncurses-base-5.7-4.20090207.14.amzn1.x86_64 ncurses-libs-5.7-4.20090207.14.amzn1.x86_64 -nspr-4.19.0-1.43.amzn1.x86_64 -nss-3.36.0-5.82.amzn1.x86_64 +nspr-4.21.0-1.43.amzn1.x86_64 +nss-3.44.0-7.84.amzn1.x86_64 nss-pem-1.0.3-4.3.amzn1.x86_64 -nss-softokn-3.36.0-5.42.amzn1.x86_64 -nss-softokn-freebl-3.36.0-5.42.amzn1.x86_64 -nss-sysinit-3.36.0-5.82.amzn1.x86_64 -nss-tools-3.36.0-5.82.amzn1.x86_64 -nss-util-3.36.0-1.54.amzn1.x86_64 +nss-softokn-3.44.0-8.44.amzn1.x86_64 +nss-softokn-freebl-3.44.0-8.44.amzn1.x86_64 +nss-sysinit-3.44.0-7.84.amzn1.x86_64 +nss-tools-3.44.0-7.84.amzn1.x86_64 +nss-util-3.44.0-4.56.amzn1.x86_64 openldap-2.4.40-16.31.amzn1.x86_64 -openssl-1.0.2k-16.150.amzn1.x86_64 +openssl-1.0.2k-16.151.amzn1.x86_64 p11-kit-0.18.5-2.3.amzn1.x86_64 p11-kit-trust-0.18.5-2.3.amzn1.x86_64 pam-1.1.8-12.33.amzn1.x86_64 @@ -181,23 +181,23 @@ popt-1.13-7.7.amzn1.x86_64 procps-3.2.8-45.16.amzn1.x86_64 psmisc-22.20-8.12.amzn1.x86_64 pth-2.0.7-9.3.7.amzn1.x86_64 -python27-2.7.16-1.130.amzn1.x86_64 +python27-2.7.18-2.140.amzn1.x86_64 python27-iniparse-0.3.1-2.1.9.amzn1.noarch -python27-libs-2.7.16-1.130.amzn1.x86_64 +python27-libs-2.7.18-2.140.amzn1.x86_64 python27-pycurl-7.19.0-17.12.amzn1.x86_64 python27-pygpgme-0.3-9.12.amzn1.x86_64 python27-pyliblzma-0.5.3-11.6.amzn1.x86_64 python27-pyxattr-0.5.0-1.6.amzn1.x86_64 python27-urlgrabber-3.10-8.16.amzn1.noarch -python36-3.6.8-1.15.amzn1.x86_64 -python36-libs-3.6.8-1.15.amzn1.x86_64 -python36-pip-9.0.3-1.26.amzn1.noarch +python36-3.6.12-1.19.amzn1.x86_64 +python36-libs-3.6.12-1.19.amzn1.x86_64 +python36-pip-9.0.3-1.27.amzn1.noarch python36-setuptools-36.2.7-1.33.amzn1.noarch readline-6.2-9.14.amzn1.x86_64 -rpm-4.11.3-40.76.amzn1.x86_64 -rpm-build-libs-4.11.3-40.76.amzn1.x86_64 -rpm-libs-4.11.3-40.76.amzn1.x86_64 -rpm-python27-4.11.3-40.76.amzn1.x86_64 +rpm-4.11.3-40.78.amzn1.x86_64 +rpm-build-libs-4.11.3-40.78.amzn1.x86_64 +rpm-libs-4.11.3-40.78.amzn1.x86_64 +rpm-python27-4.11.3-40.78.amzn1.x86_64 sed-4.2.1-10.10.amzn1.x86_64 setup-2.8.14-20.12.amzn1.noarch shadow-utils-4.1.4.2-13.10.amzn1.x86_64 @@ -207,8 +207,8 @@ sysctl-defaults-1.0-1.1.amzn1.noarch system-release-2018.03-0.0.noarch tar-1.26-31.22.amzn1.x86_64 ttmkfdir-3.0.9-32.1.5.amzn1.x86_64 -tzdata-2019c-1.73.amzn1.noarch -tzdata-java-2019c-1.73.amzn1.noarch +tzdata-2020a-1.75.amzn1.noarch +tzdata-java-2020a-1.75.amzn1.noarch unzip-6.0-4.10.amzn1.x86_64 urw-fonts-2.4-10.7.amzn1.noarch util-linux-2.23.2-59.29.amzn1.x86_64 @@ -217,7 +217,8 @@ xorg-x11-font-utils-7.2-11.5.amzn1.x86_64 xorg-x11-fonts-Type1-7.2-9.1.5.amzn1.noarch xz-5.2.2-1.13.amzn1.x86_64 xz-libs-5.2.2-1.13.amzn1.x86_64 -yum-3.4.3-150.70.amzn1.noarch +yum-3.4.3-150.71.amzn1.noarch yum-metadata-parser-1.1.4-10.20.amzn1.x86_64 +yum-plugin-ovl-1.1.31-46.30.amzn1.noarch yum-plugin-priorities-1.1.31-46.30.amzn1.noarch zlib-1.2.8-7.18.amzn1.x86_64 diff --git a/base/publish-all.sh b/base/publish-all.sh index b5f5027c..a2fb0c2b 100755 --- a/base/publish-all.sh +++ b/base/publish-all.sh @@ -1,6 +1,6 @@ #!/bin/bash -RUNTIMES="provided go1.x nodejs4.3 nodejs6.10 nodejs8.10 python2.7 python3.6 python3.7 ruby2.5 java8 dotnetcore2.0 dotnetcore2.1 nodejs10.x nodejs12.x python3.8 ruby2.7 java11 dotnetcore3.1" +source ${PWD}/runtimes.sh echo -n "Enter repository passphrase: " read -s DOCKER_CONTENT_TRUST_REPOSITORY_PASSPHRASE @@ -9,12 +9,17 @@ echo export DOCKER_CONTENT_TRUST=1 export DOCKER_CONTENT_TRUST_REPOSITORY_PASSPHRASE +export PUBLISH_DATE=$(date "+%Y%m%d") + docker push lambci/lambda-base docker push lambci/lambda-base-2 for RUNTIME in $RUNTIMES; do echo $RUNTIME + docker tag lambci/lambda:${RUNTIME} lambci/lambda:${PUBLISH_DATE}-${RUNTIME} docker push lambci/lambda:${RUNTIME} + docker push lambci/lambda:${PUBLISH_DATE}-${RUNTIME} + docker rmi lambci/lambda:${PUBLISH_DATE}-${RUNTIME} done docker push lambci/lambda-base:build @@ -22,5 +27,8 @@ docker push lambci/lambda-base-2:build for RUNTIME in $RUNTIMES; do echo build-${RUNTIME} + docker tag lambci/lambda:build-${RUNTIME} lambci/lambda:${PUBLISH_DATE}-build-${RUNTIME} docker push lambci/lambda:build-${RUNTIME} + docker push lambci/lambda:${PUBLISH_DATE}-build-${RUNTIME} + docker rmi lambci/lambda:${PUBLISH_DATE}-build-${RUNTIME} done diff --git a/base/runtimes.sh b/base/runtimes.sh new file mode 100644 index 00000000..80891dd4 --- /dev/null +++ b/base/runtimes.sh @@ -0,0 +1 @@ +RUNTIMES="provided go1.x nodejs4.3 nodejs6.10 nodejs8.10 python2.7 python3.6 python3.7 ruby2.5 java8 dotnetcore2.0 dotnetcore2.1 provided.al2 nodejs10.x nodejs12.x python3.8 ruby2.7 java8.al2 java11 dotnetcore3.1" diff --git a/base/tag-all.sh b/base/tag-all.sh index 8b9c0827..a8314ee9 100755 --- a/base/tag-all.sh +++ b/base/tag-all.sh @@ -1,6 +1,6 @@ #!/bin/bash -RUNTIMES="provided go1.x nodejs4.3 nodejs6.10 nodejs8.10 python2.7 python3.6 python3.7 ruby2.5 java8 dotnetcore2.0 dotnetcore2.1 nodejs10.x nodejs12.x python3.8 ruby2.7 java11 dotnetcore3.1" +source ${PWD}/runtimes.sh git tag -f latest diff --git a/base/test-all.sh b/base/test-all.sh index 0bded02f..c6a40c0e 100755 --- a/base/test-all.sh +++ b/base/test-all.sh @@ -34,8 +34,9 @@ docker run --rm -v "$PWD":/var/task lambci/lambda:ruby2.5 lambda_function.lambda docker run --rm -v "$PWD":/var/task lambci/lambda:ruby2.7 lambda_function.lambda_handler cd ${EXAMPLES_DIR}/java -docker run --rm -v "$PWD":/app -w /app gradle gradle build +docker run --rm -v "$PWD":/app -w /app lambci/lambda:build-java8 gradle build docker run --rm -v "$PWD/build/docker":/var/task lambci/lambda:java8 org.lambci.lambda.ExampleHandler '{"some": "event"}' +docker run --rm -v "$PWD/build/docker":/var/task lambci/lambda:java8.al2 org.lambci.lambda.ExampleHandler '{"some": "event"}' docker run --rm -v "$PWD/build/docker":/var/task lambci/lambda:java11 org.lambci.lambda.ExampleHandler '{"some": "event"}' cd ${EXAMPLES_DIR}/dotnetcore2.0 @@ -57,6 +58,11 @@ docker run --rm -v "$PWD":/var/task lambci/lambda:go1.x handler '{"Records": []} cd ${EXAMPLES_DIR}/provided docker run --rm -v "$PWD":/var/task lambci/lambda:provided handler '{"some": "event"}' +cd ${EXAMPLES_DIR}/provided.al2 +docker run --rm -v "$PWD":/go/src/handler lambci/lambda:build-go1.x sh -c 'go mod download && go build -tags lambda.norpc bootstrap.go' +docker run --rm -v "$PWD":/var/task lambci/lambda:provided.al2 handler '{"Records": []}' + # To invoke and keep open: +# cd ${EXAMPLES_DIR}/ruby # docker run --rm -v $PWD:/var/task -e DOCKER_LAMBDA_STAY_OPEN=1 -p 9001:9001 \ # lambci/lambda:ruby2.5 lambda_function.lambda_handler diff --git a/docker-lambda.code-workspace b/docker-lambda.code-workspace index 32ca28b3..975aee7f 100644 --- a/docker-lambda.code-workspace +++ b/docker-lambda.code-workspace @@ -21,6 +21,9 @@ { "path": "base/dump-java8" }, + { + "path": "base/dump-java8al2" + }, { "path": "examples/java" }, diff --git a/dotnetcore2.0/build/Dockerfile b/dotnetcore2.0/build/Dockerfile index 4e4b138d..01474732 100644 --- a/dotnetcore2.0/build/Dockerfile +++ b/dotnetcore2.0/build/Dockerfile @@ -1,3 +1,5 @@ +FROM lambci/lambda:dotnetcore2.0 + FROM lambci/lambda-base:build # Run: docker run --rm --entrypoint dotnet lambci/lambda:dotnetcore2.1 --info @@ -9,9 +11,11 @@ ENV PATH=/var/lang/bin:$PATH \ DOTNET_CLI_TELEMETRY_OPTOUT=1 \ NUGET_XMLDOC_MODE=skip -RUN rm -rf /var/runtime /var/lang && \ - curl https://lambci.s3.amazonaws.com/fs/dotnetcore2.0.tgz | tar -zx -C / && \ - yum install -y libunwind && \ +COPY --from=0 /var/runtime /var/runtime +COPY --from=0 /var/lang /var/lang +COPY --from=0 /var/rapid /var/rapid + +RUN yum install -y libunwind && \ curl -L https://dot.net/v1/dotnet-install.sh | bash -s -- -v $DOTNET_SDK_VERSION -i /var/lang/bin && \ mkdir /tmp/warmup && \ cd /tmp/warmup && \ @@ -20,6 +24,12 @@ RUN rm -rf /var/runtime /var/lang && \ rm -rf /tmp/warmup /tmp/NuGetScratch # Add these as a separate layer as they get updated frequently -RUN pip install -U aws-lambda-builders==0.9.0 aws-sam-cli==0.53.0 awscli boto3 virtualenv pipenv --no-cache-dir +# The pipx workaround is due to https://github.com/pipxproject/pipx/issues/218 +RUN source /usr/local/pipx/shared/bin/activate && \ + pipx install virtualenv && \ + pipx install pipenv && \ + pipx install awscli==1.* && \ + pipx install aws-lambda-builders==1.2.0 && \ + pipx install aws-sam-cli==1.15.0 CMD ["dotnet", "build"] diff --git a/dotnetcore2.0/run/MockBootstraps/MockLambdaContext.cs b/dotnetcore2.0/run/MockBootstraps/MockLambdaContext.cs index 1a3d6797..76d64ca8 100644 --- a/dotnetcore2.0/run/MockBootstraps/MockLambdaContext.cs +++ b/dotnetcore2.0/run/MockBootstraps/MockLambdaContext.cs @@ -42,9 +42,6 @@ public TimeSpan RemainingTime() return StartTime + TimeSpan.FromSeconds(Timeout) - DateTime.Now; } - public long Duration => (long)(DateTime.Now - StartTime).TotalMilliseconds; - public long BilledDuration => (long)(Math.Ceiling((DateTime.Now - StartTime).TotalMilliseconds / 100)) * 100; - public long DeadlineMs { set @@ -64,8 +61,6 @@ public string Body } } - public long MemoryUsed => Process.GetCurrentProcess().WorkingSet64; - public Stream InputStream { get; set; } public string RequestId { get; set; } diff --git a/dotnetcore2.0/run/MockBootstraps/MockRuntime.cs b/dotnetcore2.0/run/MockBootstraps/MockRuntime.cs index daa1df4d..7cff6ecc 100644 --- a/dotnetcore2.0/run/MockBootstraps/MockRuntime.cs +++ b/dotnetcore2.0/run/MockBootstraps/MockRuntime.cs @@ -156,8 +156,8 @@ unsafe InvokeData ILambdaRuntime.ReceiveInvoke(IDictionary initialEnvironmentVar RequestId = context.RequestId, AwsCredentials = new AwsCredentials { - AccessKeyId = EnvHelper.GetOrDefault("AWS_ACCESS_KEY_ID", "SOME_ACCESS_KEY_ID"), - SecretAccessKey = EnvHelper.GetOrDefault("AWS_SECRET_ACCESS_KEY", "SOME_SECRET_ACCESS_KEY"), + AccessKeyId = System.Environment.GetEnvironmentVariable("AWS_ACCESS_KEY_ID"), + SecretAccessKey = System.Environment.GetEnvironmentVariable("AWS_SECRET_ACCESS_KEY"), SessionToken = System.Environment.GetEnvironmentVariable("AWS_SESSION_TOKEN") }, XAmznTraceId = xAmznTraceId, diff --git a/dotnetcore2.1/build/Dockerfile b/dotnetcore2.1/build/Dockerfile index be936a46..b9aceba7 100644 --- a/dotnetcore2.1/build/Dockerfile +++ b/dotnetcore2.1/build/Dockerfile @@ -1,4 +1,6 @@ -FROM lambci/lambda-base:build +FROM lambci/lambda:dotnetcore2.1 + +FROM lambci/lambda-base:build # Run: docker run --rm --entrypoint dotnet lambci/lambda:dotnetcore2.1 --info # Check https://dotnet.microsoft.com/download/dotnet-core/2.1 for versions @@ -10,9 +12,11 @@ ENV PATH=/root/.dotnet/tools:$DOTNET_ROOT:$PATH \ DOTNET_CLI_TELEMETRY_OPTOUT=1 \ NUGET_XMLDOC_MODE=skip -RUN rm -rf /var/runtime /var/lang && \ - curl https://lambci.s3.amazonaws.com/fs/dotnetcore2.1.tgz | tar -zx -C / && \ - yum install -y libunwind && \ +COPY --from=0 /var/runtime /var/runtime +COPY --from=0 /var/lang /var/lang +COPY --from=0 /var/rapid /var/rapid + +RUN yum install -y libunwind && \ curl -L https://dot.net/v1/dotnet-install.sh | bash -s -- -v $DOTNET_SDK_VERSION -i $DOTNET_ROOT && \ mkdir /tmp/warmup && \ cd /tmp/warmup && \ @@ -21,7 +25,13 @@ RUN rm -rf /var/runtime /var/lang && \ rm -rf /tmp/warmup /tmp/NuGetScratch /tmp/.dotnet # Add these as a separate layer as they get updated frequently -RUN pip install -U aws-lambda-builders==0.9.0 aws-sam-cli==0.53.0 awscli boto3 virtualenv pipenv --no-cache-dir && \ +# The pipx workaround is due to https://github.com/pipxproject/pipx/issues/218 +RUN source /usr/local/pipx/shared/bin/activate && \ + pipx install virtualenv && \ + pipx install pipenv && \ + pipx install awscli==1.* && \ + pipx install aws-lambda-builders==1.2.0 && \ + pipx install aws-sam-cli==1.15.0 && \ dotnet tool install --global Amazon.Lambda.Tools --version 3.3.1 CMD ["dotnet", "build"] diff --git a/dotnetcore2.1/run/MockBootstraps/MockLambdaContext.cs b/dotnetcore2.1/run/MockBootstraps/MockLambdaContext.cs index 1a3d6797..76d64ca8 100644 --- a/dotnetcore2.1/run/MockBootstraps/MockLambdaContext.cs +++ b/dotnetcore2.1/run/MockBootstraps/MockLambdaContext.cs @@ -42,9 +42,6 @@ public TimeSpan RemainingTime() return StartTime + TimeSpan.FromSeconds(Timeout) - DateTime.Now; } - public long Duration => (long)(DateTime.Now - StartTime).TotalMilliseconds; - public long BilledDuration => (long)(Math.Ceiling((DateTime.Now - StartTime).TotalMilliseconds / 100)) * 100; - public long DeadlineMs { set @@ -64,8 +61,6 @@ public string Body } } - public long MemoryUsed => Process.GetCurrentProcess().WorkingSet64; - public Stream InputStream { get; set; } public string RequestId { get; set; } diff --git a/dotnetcore2.1/run/MockBootstraps/MockRuntime.cs b/dotnetcore2.1/run/MockBootstraps/MockRuntime.cs index c3827321..51ee0887 100644 --- a/dotnetcore2.1/run/MockBootstraps/MockRuntime.cs +++ b/dotnetcore2.1/run/MockBootstraps/MockRuntime.cs @@ -157,8 +157,8 @@ unsafe InvokeData ILambdaRuntime.ReceiveInvoke(IDictionary initialEnvironmentVar RequestId = context.RequestId, AwsCredentials = new AwsCredentials { - AccessKeyId = EnvHelper.GetOrDefault("AWS_ACCESS_KEY_ID", "SOME_ACCESS_KEY_ID"), - SecretAccessKey = EnvHelper.GetOrDefault("AWS_SECRET_ACCESS_KEY", "SOME_SECRET_ACCESS_KEY"), + AccessKeyId = System.Environment.GetEnvironmentVariable("AWS_ACCESS_KEY_ID"), + SecretAccessKey = System.Environment.GetEnvironmentVariable("AWS_SECRET_ACCESS_KEY"), SessionToken = System.Environment.GetEnvironmentVariable("AWS_SESSION_TOKEN") }, XAmznTraceId = xAmznTraceId, diff --git a/dotnetcore2.1/run/MockBootstraps/lib/Bootstrap.dll b/dotnetcore2.1/run/MockBootstraps/lib/Bootstrap.dll index 4880d8fd..0711afac 100644 Binary files a/dotnetcore2.1/run/MockBootstraps/lib/Bootstrap.dll and b/dotnetcore2.1/run/MockBootstraps/lib/Bootstrap.dll differ diff --git a/dotnetcore2.1/run/MockBootstraps/lib/Bootstrap.pdb b/dotnetcore2.1/run/MockBootstraps/lib/Bootstrap.pdb index 3f913c8b..ddc2c4d4 100644 Binary files a/dotnetcore2.1/run/MockBootstraps/lib/Bootstrap.pdb and b/dotnetcore2.1/run/MockBootstraps/lib/Bootstrap.pdb differ diff --git a/dotnetcore3.1/build/Dockerfile b/dotnetcore3.1/build/Dockerfile index e2cfdcf9..5952e362 100644 --- a/dotnetcore3.1/build/Dockerfile +++ b/dotnetcore3.1/build/Dockerfile @@ -1,4 +1,6 @@ -FROM lambci/lambda-base-2:build +FROM lambci/lambda:dotnetcore3.1 + +FROM lambci/lambda-base-2:build # Run: docker run --rm --entrypoint dotnet lambci/lambda:dotnetcore3.1 --info # Check https://dotnet.microsoft.com/download/dotnet-core/3.1 for versions @@ -6,13 +8,15 @@ ENV DOTNET_ROOT=/var/lang/bin ENV PATH=/root/.dotnet/tools:$DOTNET_ROOT:$PATH \ LD_LIBRARY_PATH=/var/lang/lib:$LD_LIBRARY_PATH \ AWS_EXECUTION_ENV=AWS_Lambda_dotnetcore3.1 \ - DOTNET_SDK_VERSION=3.1.301 \ + DOTNET_SDK_VERSION=3.1.405 \ DOTNET_CLI_TELEMETRY_OPTOUT=1 \ NUGET_XMLDOC_MODE=skip -RUN rm -rf /var/runtime /var/lang && \ - curl https://lambci.s3.amazonaws.com/fs/dotnetcore3.1.tgz | tar -zx -C / && \ - curl -L https://dot.net/v1/dotnet-install.sh | bash -s -- -v $DOTNET_SDK_VERSION -i $DOTNET_ROOT && \ +COPY --from=0 /var/runtime /var/runtime +COPY --from=0 /var/lang /var/lang +COPY --from=0 /var/rapid /var/rapid + +RUN curl -L https://dot.net/v1/dotnet-install.sh | bash -s -- -v $DOTNET_SDK_VERSION -i $DOTNET_ROOT && \ mkdir /tmp/warmup && \ cd /tmp/warmup && \ dotnet new && \ @@ -20,7 +24,9 @@ RUN rm -rf /var/runtime /var/lang && \ rm -rf /tmp/warmup /tmp/NuGetScratch /tmp/.dotnet # Add these as a separate layer as they get updated frequently -RUN pip install -U aws-lambda-builders==0.9.0 aws-sam-cli==0.53.0 awscli boto3 --no-cache-dir && \ +RUN pipx install awscli==1.* && \ + pipx install aws-lambda-builders==1.2.0 && \ + pipx install aws-sam-cli==1.15.0 && \ dotnet tool install --global Amazon.Lambda.Tools --version 4.0.0 CMD ["dotnet", "build"] diff --git a/examples/go1.x/go.mod b/examples/go1.x/go.mod index 258e8af4..bcc119a6 100644 --- a/examples/go1.x/go.mod +++ b/examples/go1.x/go.mod @@ -2,4 +2,4 @@ module handler require github.com/aws/aws-lambda-go v1.13.3 -go 1.14 +go 1.15 diff --git a/examples/java/.project b/examples/java/.project index b4c37dd9..123c68bd 100644 --- a/examples/java/.project +++ b/examples/java/.project @@ -20,4 +20,15 @@ org.eclipse.jdt.core.javanature org.eclipse.buildship.core.gradleprojectnature + + + 1599680497045 + + 30 + + org.eclipse.core.resources.regexFilterMatcher + node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ + + + diff --git a/examples/java/.settings/org.eclipse.buildship.core.prefs b/examples/java/.settings/org.eclipse.buildship.core.prefs index 39c6821c..90865998 100644 --- a/examples/java/.settings/org.eclipse.buildship.core.prefs +++ b/examples/java/.settings/org.eclipse.buildship.core.prefs @@ -1,7 +1,7 @@ arguments= auto.sync=false build.scans.enabled=false -connection.gradle.distribution=GRADLE_DISTRIBUTION(VERSION(6.0-20191016123526+0000)) +connection.gradle.distribution=GRADLE_DISTRIBUTION(VERSION(6.3)) connection.project.dir= eclipse.preferences.version=1 gradle.user.home= diff --git a/examples/nodejs-native-module/package-lock.json b/examples/nodejs-native-module/package-lock.json index 4efd95c6..1beaa4c1 100644 --- a/examples/nodejs-native-module/package-lock.json +++ b/examples/nodejs-native-module/package-lock.json @@ -34,12 +34,12 @@ "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" }, "bcrypt": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/bcrypt/-/bcrypt-4.0.1.tgz", - "integrity": "sha512-hSIZHkUxIDS5zA2o00Kf2O5RfVbQ888n54xQoF/eIaquU4uaLxK8vhhBdktd0B3n2MjkcAWzv4mnhogykBKOUQ==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/bcrypt/-/bcrypt-5.0.0.tgz", + "integrity": "sha512-jB0yCBl4W/kVHM2whjfyqnxTmOHkCX4kHEa5nYKSoGeYe8YrjTYTc87/6bwt1g8cmV0QrbhKriETg9jWtcREhg==", "requires": { - "node-addon-api": "^2.0.0", - "node-pre-gyp": "0.14.0" + "node-addon-api": "^3.0.0", + "node-pre-gyp": "0.15.0" } }, "brace-expansion": { @@ -224,9 +224,9 @@ } }, "mkdirp": { - "version": "0.5.4", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.4.tgz", - "integrity": "sha512-iG9AK/dJLtJ0XNgTuDbSyNS3zECqDlAhnQW4CsNxBG3LQJBbHmRX1egw39DmtOdCAqY+dKXV+sgPgilNWUKMVw==", + "version": "0.5.5", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", + "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==", "requires": { "minimist": "^1.2.5" } @@ -237,9 +237,9 @@ "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" }, "needle": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/needle/-/needle-2.3.3.tgz", - "integrity": "sha512-EkY0GeSq87rWp1hoq/sH/wnTWgFVhYlnIkbJ0YJFfRgEFlz2RraCjBpFQ+vrEgEdp0ThfyHADmkChEhcb7PKyw==", + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/needle/-/needle-2.5.0.tgz", + "integrity": "sha512-o/qITSDR0JCyCKEQ1/1bnUXMmznxabbwi/Y4WwJElf+evwJNFNwIDMCCt5IigFVxgeGBJESLohGtIS9gEzo1fA==", "requires": { "debug": "^3.2.6", "iconv-lite": "^0.4.4", @@ -247,18 +247,18 @@ } }, "node-addon-api": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-2.0.0.tgz", - "integrity": "sha512-ASCL5U13as7HhOExbT6OlWJJUV/lLzL2voOSP1UVehpRD8FbSrSDjfScK/KwAvVTI5AS6r4VwbOMlIqtvRidnA==" + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-3.0.0.tgz", + "integrity": "sha512-sSHCgWfJ+Lui/u+0msF3oyCgvdkhxDbkCS6Q8uiJquzOimkJBvX6hl5aSSA7DR1XbMpdM8r7phjcF63sF4rkKg==" }, "node-pre-gyp": { - "version": "0.14.0", - "resolved": "https://registry.npmjs.org/node-pre-gyp/-/node-pre-gyp-0.14.0.tgz", - "integrity": "sha512-+CvDC7ZttU/sSt9rFjix/P05iS43qHCOOGzcr3Ry99bXG7VX953+vFyEuph/tfqoYu8dttBkE86JSKBO2OzcxA==", + "version": "0.15.0", + "resolved": "https://registry.npmjs.org/node-pre-gyp/-/node-pre-gyp-0.15.0.tgz", + "integrity": "sha512-7QcZa8/fpaU/BKenjcaeFF9hLz2+7S9AqyXFhlH/rilsQ/hPZKK32RtR5EQHJElgu+q5RfbJ34KriI79UWaorA==", "requires": { "detect-libc": "^1.0.2", - "mkdirp": "^0.5.1", - "needle": "^2.2.1", + "mkdirp": "^0.5.3", + "needle": "^2.5.0", "nopt": "^4.0.1", "npm-packlist": "^1.1.6", "npmlog": "^4.0.2", diff --git a/examples/nodejs-native-module/package.json b/examples/nodejs-native-module/package.json index 7a043bda..1917e45b 100644 --- a/examples/nodejs-native-module/package.json +++ b/examples/nodejs-native-module/package.json @@ -7,6 +7,6 @@ "test": "node test.js" }, "dependencies": { - "bcrypt": "^4.0.1" + "bcrypt": "^5.0.0" } } diff --git a/examples/provided.al2/bootstrap.go b/examples/provided.al2/bootstrap.go new file mode 100644 index 00000000..e71e3518 --- /dev/null +++ b/examples/provided.al2/bootstrap.go @@ -0,0 +1,27 @@ +// Compile with: +// docker run --rm -v "$PWD":/go/src/handler lambci/lambda:build-go1.x sh -c 'go mod download && go build -tags lambda.norpc bootstrap.go' + +// Run with: +// docker run --rm -v "$PWD":/var/task lambci/lambda:provided.al2 handler '{"Records": []}' + +package main + +import ( + "context" + "fmt" + + "github.com/aws/aws-lambda-go/events" + "github.com/aws/aws-lambda-go/lambda" +) + +func handleRequest(ctx context.Context, event events.S3Event) (string, error) { + fmt.Println(ctx) + + fmt.Println(event) + + return "Hello World!", nil +} + +func main() { + lambda.Start(handleRequest) +} diff --git a/examples/provided.al2/go.mod b/examples/provided.al2/go.mod new file mode 100644 index 00000000..4fc94c95 --- /dev/null +++ b/examples/provided.al2/go.mod @@ -0,0 +1,8 @@ +module bootstrap + +require ( + github.com/aws/aws-lambda-go v1.19.0 + github.com/aws/aws-sdk-go-v2 v0.24.0 +) + +go 1.15 diff --git a/examples/provided.al2/go.sum b/examples/provided.al2/go.sum new file mode 100644 index 00000000..8da6f30f --- /dev/null +++ b/examples/provided.al2/go.sum @@ -0,0 +1,27 @@ +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/aws/aws-lambda-go v1.19.0 h1:Cn28zA8Mic4NpR7p4IlaEW2srI+U3+I7tRqjFMpt/fs= +github.com/aws/aws-lambda-go v1.19.0/go.mod h1:jJmlefzPfGnckuHdXX7/80O3BvUUi12XOkbv4w9SGLU= +github.com/aws/aws-sdk-go-v2 v0.24.0/go.mod h1:2LhT7UgHOXK3UXONKI5OMgIyoQL6zTAw/jwIeX6yqzw= +github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/urfave/cli/v2 v2.2.0/go.mod h1:SE9GqnLQmjVa0iPEY0f1w3ygNIYcIJ0OKPMoW2caLfQ= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/go1.x/build/Dockerfile b/go1.x/build/Dockerfile index 258b3216..87ffda03 100644 --- a/go1.x/build/Dockerfile +++ b/go1.x/build/Dockerfile @@ -1,21 +1,29 @@ +FROM lambci/lambda:go1.x + FROM lambci/lambda-base:build # https://golang.org/doc/devel/release.html -ENV GOLANG_VERSION=1.14.4 \ +ENV GOLANG_VERSION=1.15 \ GOPATH=/go \ PATH=/go/bin:/usr/local/go/bin:$PATH \ AWS_EXECUTION_ENV=AWS_Lambda_go1.x WORKDIR /go/src/handler -RUN rm -rf /var/runtime /var/lang && \ - curl https://lambci.s3.amazonaws.com/fs/go1.x.tgz | tar -zx -C / && \ - curl https://storage.googleapis.com/golang/go${GOLANG_VERSION}.linux-amd64.tar.gz | tar -zx -C /usr/local && \ +COPY --from=0 /var/runtime /var/runtime +COPY --from=0 /var/lang /var/lang +COPY --from=0 /var/rapid /var/rapid + +RUN curl https://storage.googleapis.com/golang/go${GOLANG_VERSION}.linux-amd64.tar.gz | tar -zx -C /usr/local && \ go get github.com/golang/dep/cmd/dep && \ go install github.com/golang/dep/cmd/dep && \ go get golang.org/x/vgo # Add these as a separate layer as they get updated frequently -RUN pip install -U aws-lambda-builders==0.9.0 aws-sam-cli==0.53.0 awscli boto3 --no-cache-dir +# The pipx workaround is due to https://github.com/pipxproject/pipx/issues/218 +RUN source /usr/local/pipx/shared/bin/activate && \ + pipx install awscli==1.* && \ + pipx install aws-lambda-builders==1.2.0 && \ + pipx install aws-sam-cli==1.15.0 CMD ["dep", "ensure"] diff --git a/go1.x/run/aws-lambda-mock.go b/go1.x/run/aws-lambda-mock.go index 103a52d9..885f0200 100644 --- a/go1.x/run/aws-lambda-mock.go +++ b/go1.x/run/aws-lambda-mock.go @@ -76,8 +76,8 @@ func main() { } mockContext.ParseTimeout() - awsAccessKey := getEnv("AWS_ACCESS_KEY", getEnv("AWS_ACCESS_KEY_ID", "SOME_ACCESS_KEY_ID")) - awsSecretKey := getEnv("AWS_SECRET_KEY", getEnv("AWS_SECRET_ACCESS_KEY", "SOME_SECRET_ACCESS_KEY")) + awsAccessKey := getEnv("AWS_ACCESS_KEY", os.Getenv("AWS_ACCESS_KEY_ID")) + awsSecretKey := getEnv("AWS_SECRET_KEY", os.Getenv("AWS_SECRET_ACCESS_KEY")) awsSessionToken := getEnv("AWS_SESSION_TOKEN", os.Getenv("AWS_SECURITY_TOKEN")) port := getEnv("_LAMBDA_SERVER_PORT", "54321") diff --git a/go1.x/run/go.mod b/go1.x/run/go.mod index 21bd0b6d..182b72af 100644 --- a/go1.x/run/go.mod +++ b/go1.x/run/go.mod @@ -2,4 +2,4 @@ module aws-lambda-mock require github.com/aws/aws-lambda-go v1.13.3 -go 1.14 +go 1.15 diff --git a/java11/build/Dockerfile b/java11/build/Dockerfile index a4953ff8..6b2f3c90 100644 --- a/java11/build/Dockerfile +++ b/java11/build/Dockerfile @@ -1,17 +1,23 @@ +FROM lambci/lambda:java11 + FROM lambci/lambda-base-2:build ENV PATH=/var/lang/bin:$PATH \ LD_LIBRARY_PATH=/var/lang/lib:$LD_LIBRARY_PATH \ AWS_EXECUTION_ENV=AWS_Lambda_java11 -RUN rm -rf /var/runtime /var/lang /var/rapid && \ - curl https://lambci.s3.amazonaws.com/fs/java11.tgz | tar -zx -C / && \ - mkdir /usr/local/gradle && curl -L -o gradle.zip https://downloads.gradle-dn.com/distributions/gradle-6.4.1-bin.zip && \ - unzip -d /usr/local/gradle gradle.zip && rm gradle.zip && mkdir /usr/local/maven && \ +COPY --from=0 /var/runtime /var/runtime +COPY --from=0 /var/lang /var/lang +COPY --from=0 /var/rapid /var/rapid + +RUN mkdir /usr/local/gradle && curl -L -o gradle.zip https://services.gradle.org/distributions/gradle-6.8.1-bin.zip && \ + unzip -qd /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.4.1/bin:/usr/local/maven/apache-maven-3.6.3/bin:${PATH}" +ENV PATH="/usr/local/gradle/gradle-6.8.1/bin:/usr/local/maven/apache-maven-3.6.3/bin:${PATH}" # Add these as a separate layer as they get updated frequently -RUN pip install -U aws-lambda-builders==0.9.0 aws-sam-cli==0.53.0 awscli boto3 --no-cache-dir +RUN pipx install awscli==1.* && \ + pipx install aws-lambda-builders==1.2.0 && \ + pipx install aws-sam-cli==1.15.0 diff --git a/java8.al2/build/Dockerfile b/java8.al2/build/Dockerfile new file mode 100644 index 00000000..0edeb604 --- /dev/null +++ b/java8.al2/build/Dockerfile @@ -0,0 +1,26 @@ +FROM lambci/lambda:java8.al2 + +FROM lambci/lambda-base-2:build + +ENV PATH=/var/lang/bin:$PATH \ + LD_LIBRARY_PATH=/var/lang/lib:$LD_LIBRARY_PATH \ + AWS_EXECUTION_ENV=AWS_Lambda_rapid + +COPY --from=0 /var/runtime /var/runtime +COPY --from=0 /var/lang /var/lang +COPY --from=0 /var/rapid /var/rapid + +RUN rm -rf /var/lang/* && \ + curl -sSL https://corretto.aws/downloads/resources/8.265.01.1/amazon-corretto-8.265.01.1-linux-x64.tar.gz | tar -xz --strip-components=1 -C /var/lang && \ + rm -rf /var/lang/*.zip && \ + mkdir /usr/local/gradle && curl -L -o gradle.zip https://services.gradle.org/distributions/gradle-6.8.1-bin.zip && \ + unzip -qd /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.8.1/bin:/usr/local/maven/apache-maven-3.6.3/bin:${PATH}" + +# Add these as a separate layer as they get updated frequently +RUN pipx install awscli==1.* && \ + pipx install aws-lambda-builders==1.2.0 && \ + pipx install aws-sam-cli==1.15.0 diff --git a/java8.al2/run/Dockerfile b/java8.al2/run/Dockerfile new file mode 100644 index 00000000..7c912988 --- /dev/null +++ b/java8.al2/run/Dockerfile @@ -0,0 +1,21 @@ +FROM lambci/lambda-base + +RUN curl https://lambci.s3.amazonaws.com/fs/java8.al2.tgz | tar -zx -C /opt + + +FROM lambci/lambda:provided + + +FROM lambci/lambda-base-2 + +ENV PATH=/var/lang/bin:$PATH \ + LD_LIBRARY_PATH=/var/lang/lib:$LD_LIBRARY_PATH \ + AWS_EXECUTION_ENV=AWS_Lambda_rapid + +COPY --from=0 /opt/* /var/ + +COPY --from=1 /var/runtime/init /var/rapid/init + +USER sbx_user1051 + +ENTRYPOINT ["/var/rapid/init", "--bootstrap", "/var/runtime/bootstrap", "--enable-msg-logs"] diff --git a/java8/build/Dockerfile b/java8/build/Dockerfile index eb5a62c7..25e65cd4 100644 --- a/java8/build/Dockerfile +++ b/java8/build/Dockerfile @@ -1,18 +1,26 @@ +FROM lambci/lambda:java8 + FROM lambci/lambda-base:build ENV AWS_EXECUTION_ENV=AWS_Lambda_java8 WORKDIR / -RUN rm -rf /var/runtime /var/lang && \ - curl https://lambci.s3.amazonaws.com/fs/java8.tgz | tar -zx -C / && \ - yum install -y java-1.8.0-openjdk-devel && \ - mkdir /usr/local/gradle && curl -L -o gradle.zip https://downloads.gradle-dn.com/distributions/gradle-6.4.1-bin.zip && \ - unzip -d /usr/local/gradle gradle.zip && rm gradle.zip && mkdir /usr/local/maven && \ +COPY --from=0 /var/runtime /var/runtime +COPY --from=0 /var/lang /var/lang +COPY --from=0 /var/rapid /var/rapid + +RUN yum install -y java-1.8.0-openjdk-devel && \ + mkdir /usr/local/gradle && curl -L -o gradle.zip https://services.gradle.org/distributions/gradle-6.8.1-bin.zip && \ + unzip -qd /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.4.1/bin:/usr/local/maven/apache-maven-3.6.3/bin:${PATH}" +ENV PATH="/usr/local/gradle/gradle-6.8.1/bin:/usr/local/maven/apache-maven-3.6.3/bin:${PATH}" # Add these as a separate layer as they get updated frequently -RUN pip install -U aws-lambda-builders==0.9.0 aws-sam-cli==0.53.0 awscli boto3 --no-cache-dir +# The pipx workaround is due to https://github.com/pipxproject/pipx/issues/218 +RUN source /usr/local/pipx/shared/bin/activate && \ + pipx install awscli==1.* && \ + pipx install aws-lambda-builders==1.2.0 && \ + pipx install aws-sam-cli==1.15.0 diff --git a/java8/run/lambda-runtime-mock/.project b/java8/run/lambda-runtime-mock/.project index e2f6a921..f980c6e2 100644 --- a/java8/run/lambda-runtime-mock/.project +++ b/java8/run/lambda-runtime-mock/.project @@ -1,17 +1,28 @@ - lambda-runtime-mock - - - - - - org.eclipse.jdt.core.javabuilder - - - - - - org.eclipse.jdt.core.javanature - + lambda-runtime-mock + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + + + 1599680497051 + + 30 + + org.eclipse.core.resources.regexFilterMatcher + node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ + + + diff --git a/java8/run/lambda-runtime-mock/src/main/java/lambdainternal/LambdaRuntime.java b/java8/run/lambda-runtime-mock/src/main/java/lambdainternal/LambdaRuntime.java index d2b9df1a..d7999155 100644 --- a/java8/run/lambda-runtime-mock/src/main/java/lambdainternal/LambdaRuntime.java +++ b/java8/run/lambda-runtime-mock/src/main/java/lambdainternal/LambdaRuntime.java @@ -11,6 +11,7 @@ import java.net.URL; import java.nio.charset.StandardCharsets; import java.text.SimpleDateFormat; +import java.util.ArrayList; import java.util.Arrays; import java.util.Base64; import java.util.Date; @@ -20,6 +21,7 @@ import java.util.UUID; import com.google.gson.Gson; +import com.google.gson.JsonObject; import sun.misc.Unsafe; import sun.misc.Signal; @@ -42,6 +44,7 @@ public class LambdaRuntime { private static long deadlineMs; private static boolean invoked = false; private static boolean errored = false; + private static String errorMsg = ""; private static boolean initEndSent = false; private static long initEnd; private static long receivedInvokeAt; @@ -69,8 +72,8 @@ public class LambdaRuntime { FUNCTION_VERSION = getEnvOrDefault("AWS_LAMBDA_FUNCTION_VERSION", "$LATEST"); LOG_GROUP_NAME = getEnvOrDefault("AWS_LAMBDA_LOG_GROUP_NAME", "/aws/lambda/" + FUNCTION_NAME); LOG_STREAM_NAME = getEnvOrDefault("AWS_LAMBDA_LOG_STREAM_NAME", randomLogStreamName(FUNCTION_VERSION)); - AWS_ACCESS_KEY_ID = getEnvOrDefault("AWS_ACCESS_KEY_ID", "SOME_ACCESS_KEY_ID"); - AWS_SECRET_ACCESS_KEY = getEnvOrDefault("AWS_SECRET_ACCESS_KEY", "SOME_SECRET_ACCESS_KEY"); + AWS_ACCESS_KEY_ID = getEnv("AWS_ACCESS_KEY_ID"); + AWS_SECRET_ACCESS_KEY = getEnv("AWS_SECRET_ACCESS_KEY"); AWS_SESSION_TOKEN = getEnv("AWS_SESSION_TOKEN"); AWS_REGION = getEnvOrDefault("AWS_REGION", getEnvOrDefault("AWS_DEFAULT_REGION", "us-east-1")); @@ -216,6 +219,13 @@ public static void reportDone(final String invokeid, final byte[] result, final byte[] resultCopy = result == null ? new byte[0] : new String(result, 0, resultLength).getBytes(StandardCharsets.UTF_8); + + if (errored && resultCopy.length == 0) { + JsonObject errObject = new JsonObject(); + errObject.addProperty("errorMessage", !isNullOrEmpty(errorMsg) ? errorMsg : "Unknown error"); + resultCopy = errObject.toString().getBytes(StandardCharsets.UTF_8); + } + try (OutputStream os = conn.getOutputStream()) { os.write(resultCopy); } @@ -231,7 +241,20 @@ public static void reportDone(final String invokeid, final byte[] result, final public static void reportFault(final String invokeid, final String msg, final String exceptionClass, final String stack) { errored = true; - systemErr(stack); + ArrayList errorPieces = new ArrayList(); + if (exceptionClass != null) { + systemErr(exceptionClass); + errorPieces.add(exceptionClass); + } + if (msg != null) { + systemErr(msg); + errorPieces.add(msg); + } + if (stack != null) { + systemErr(stack); + errorPieces.add(stack); + } + errorMsg = String.join("\n", errorPieces); } public static int getRemainingTime() { diff --git a/nodejs10.x/build/Dockerfile b/nodejs10.x/build/Dockerfile index 4f41af70..4b7bb8ff 100644 --- a/nodejs10.x/build/Dockerfile +++ b/nodejs10.x/build/Dockerfile @@ -1,3 +1,5 @@ +FROM lambci/lambda:nodejs10.x + FROM lambci/lambda-base-2:build ENV PATH=/var/lang/bin:$PATH \ @@ -5,8 +7,11 @@ ENV PATH=/var/lang/bin:$PATH \ AWS_EXECUTION_ENV=AWS_Lambda_nodejs10.x \ NODE_PATH=/opt/nodejs/node10/node_modules:/opt/nodejs/node_modules:/var/runtime/node_modules -RUN rm -rf /var/runtime /var/lang /var/rapid && \ - curl https://lambci.s3.amazonaws.com/fs/nodejs10.x.tgz | tar -zx -C / +COPY --from=0 /var/runtime /var/runtime +COPY --from=0 /var/lang /var/lang +COPY --from=0 /var/rapid /var/rapid # Add these as a separate layer as they get updated frequently -RUN pip install -U aws-lambda-builders==0.9.0 aws-sam-cli==0.53.0 awscli boto3 --no-cache-dir +RUN pipx install awscli==1.* && \ + pipx install aws-lambda-builders==1.2.0 && \ + pipx install aws-sam-cli==1.15.0 diff --git a/nodejs12.x/build/Dockerfile b/nodejs12.x/build/Dockerfile index 51dfeb4e..98833ba5 100644 --- a/nodejs12.x/build/Dockerfile +++ b/nodejs12.x/build/Dockerfile @@ -1,3 +1,5 @@ +FROM lambci/lambda:nodejs12.x + FROM lambci/lambda-base-2:build ENV PATH=/var/lang/bin:$PATH \ @@ -5,8 +7,11 @@ ENV PATH=/var/lang/bin:$PATH \ AWS_EXECUTION_ENV=AWS_Lambda_nodejs12.x \ NODE_PATH=/opt/nodejs/node12/node_modules:/opt/nodejs/node_modules:/var/runtime/node_modules -RUN rm -rf /var/runtime /var/lang /var/rapid && \ - curl https://lambci.s3.amazonaws.com/fs/nodejs12.x.tgz | tar -zx -C / +COPY --from=0 /var/runtime /var/runtime +COPY --from=0 /var/lang /var/lang +COPY --from=0 /var/rapid /var/rapid # Add these as a separate layer as they get updated frequently -RUN pip install -U aws-lambda-builders==0.9.0 aws-sam-cli==0.53.0 awscli boto3 --no-cache-dir +RUN pipx install awscli==1.* && \ + pipx install aws-lambda-builders==1.2.0 && \ + pipx install aws-sam-cli==1.15.0 diff --git a/nodejs4.3/build/Dockerfile b/nodejs4.3/build/Dockerfile index c6420f90..c971ca69 100644 --- a/nodejs4.3/build/Dockerfile +++ b/nodejs4.3/build/Dockerfile @@ -1,3 +1,5 @@ +FROM lambci/lambda:nodejs4.3 + FROM lambci/lambda-base:build ENV PATH=/var/lang/bin:$PATH \ @@ -6,10 +8,15 @@ ENV PATH=/var/lang/bin:$PATH \ NODE_PATH=/var/runtime:/var/task:/var/runtime/node_modules \ npm_config_unsafe-perm=true -RUN rm -rf /var/runtime /var/lang && \ - curl https://lambci.s3.amazonaws.com/fs/nodejs4.3.tgz | tar -zx -C / +COPY --from=0 /var/runtime /var/runtime +COPY --from=0 /var/lang /var/lang +COPY --from=0 /var/rapid /var/rapid # Add these as a separate layer as they get updated frequently -RUN pip install -U aws-lambda-builders==0.9.0 aws-sam-cli==0.53.0 awscli boto3 --no-cache-dir +# The pipx workaround is due to https://github.com/pipxproject/pipx/issues/218 +RUN source /usr/local/pipx/shared/bin/activate && \ + pipx install awscli==1.* && \ + pipx install aws-lambda-builders==1.2.0 && \ + pipx install aws-sam-cli==1.15.0 CMD ["npm", "rebuild"] diff --git a/nodejs4.3/run/awslambda-mock.js b/nodejs4.3/run/awslambda-mock.js index dec5ee15..254062e3 100644 --- a/nodejs4.3/run/awslambda-mock.js +++ b/nodejs4.3/run/awslambda-mock.js @@ -21,8 +21,8 @@ var MEM_SIZE = process.env.AWS_LAMBDA_FUNCTION_MEMORY_SIZE || '1536' var TIMEOUT = process.env.AWS_LAMBDA_FUNCTION_TIMEOUT || '300' var REGION = process.env.AWS_REGION || process.env.AWS_DEFAULT_REGION || 'us-east-1' var ACCOUNT_ID = process.env.AWS_ACCOUNT_ID || randomAccountId() -var ACCESS_KEY_ID = process.env.AWS_ACCESS_KEY_ID || 'SOME_ACCESS_KEY_ID' -var SECRET_ACCESS_KEY = process.env.AWS_SECRET_ACCESS_KEY || 'SOME_SECRET_ACCESS_KEY' +var ACCESS_KEY_ID = process.env.AWS_ACCESS_KEY_ID +var SECRET_ACCESS_KEY = process.env.AWS_SECRET_ACCESS_KEY var SESSION_TOKEN = process.env.AWS_SESSION_TOKEN var INVOKED_ARN = process.env.AWS_LAMBDA_FUNCTION_INVOKED_ARN || arn(REGION, ACCOUNT_ID, FN_NAME) var TRACE_ID = process.env._X_AMZN_TRACE_ID diff --git a/nodejs6.10/build/Dockerfile b/nodejs6.10/build/Dockerfile index c9eb1b24..a544d6f7 100644 --- a/nodejs6.10/build/Dockerfile +++ b/nodejs6.10/build/Dockerfile @@ -1,3 +1,5 @@ +FROM lambci/lambda:nodejs6.10 + FROM lambci/lambda-base:build ENV PATH=/var/lang/bin:$PATH \ @@ -6,10 +8,15 @@ ENV PATH=/var/lang/bin:$PATH \ NODE_PATH=/opt/nodejs/node6/node_modules:/opt/nodejs/node_modules:/var/runtime/node_modules:/var/runtime:/var/task:/var/runtime/node_modules \ npm_config_unsafe-perm=true -RUN rm -rf /var/runtime /var/lang && \ - curl https://lambci.s3.amazonaws.com/fs/nodejs6.10.tgz | tar -zx -C / +COPY --from=0 /var/runtime /var/runtime +COPY --from=0 /var/lang /var/lang +COPY --from=0 /var/rapid /var/rapid # Add these as a separate layer as they get updated frequently -RUN pip install -U aws-lambda-builders==0.9.0 aws-sam-cli==0.53.0 awscli boto3 --no-cache-dir +# The pipx workaround is due to https://github.com/pipxproject/pipx/issues/218 +RUN source /usr/local/pipx/shared/bin/activate && \ + pipx install awscli==1.* && \ + pipx install aws-lambda-builders==1.2.0 && \ + pipx install aws-sam-cli==1.15.0 CMD ["npm", "rebuild"] diff --git a/nodejs6.10/run/awslambda-mock.js b/nodejs6.10/run/awslambda-mock.js index dec5ee15..254062e3 100644 --- a/nodejs6.10/run/awslambda-mock.js +++ b/nodejs6.10/run/awslambda-mock.js @@ -21,8 +21,8 @@ var MEM_SIZE = process.env.AWS_LAMBDA_FUNCTION_MEMORY_SIZE || '1536' var TIMEOUT = process.env.AWS_LAMBDA_FUNCTION_TIMEOUT || '300' var REGION = process.env.AWS_REGION || process.env.AWS_DEFAULT_REGION || 'us-east-1' var ACCOUNT_ID = process.env.AWS_ACCOUNT_ID || randomAccountId() -var ACCESS_KEY_ID = process.env.AWS_ACCESS_KEY_ID || 'SOME_ACCESS_KEY_ID' -var SECRET_ACCESS_KEY = process.env.AWS_SECRET_ACCESS_KEY || 'SOME_SECRET_ACCESS_KEY' +var ACCESS_KEY_ID = process.env.AWS_ACCESS_KEY_ID +var SECRET_ACCESS_KEY = process.env.AWS_SECRET_ACCESS_KEY var SESSION_TOKEN = process.env.AWS_SESSION_TOKEN var INVOKED_ARN = process.env.AWS_LAMBDA_FUNCTION_INVOKED_ARN || arn(REGION, ACCOUNT_ID, FN_NAME) var TRACE_ID = process.env._X_AMZN_TRACE_ID diff --git a/nodejs8.10/build/Dockerfile b/nodejs8.10/build/Dockerfile index b6b4a8bc..f87e8a22 100644 --- a/nodejs8.10/build/Dockerfile +++ b/nodejs8.10/build/Dockerfile @@ -1,3 +1,5 @@ +FROM lambci/lambda:nodejs8.10 + FROM lambci/lambda-base:build ENV PATH=/var/lang/bin:$PATH \ @@ -6,10 +8,15 @@ ENV PATH=/var/lang/bin:$PATH \ NODE_PATH=/opt/nodejs/node8/node_modules:/opt/nodejs/node_modules:/var/runtime/node_modules:/var/runtime:/var/task:/var/runtime/node_modules \ npm_config_unsafe-perm=true -RUN rm -rf /var/runtime /var/lang && \ - curl https://lambci.s3.amazonaws.com/fs/nodejs8.10.tgz | tar -zx -C / +COPY --from=0 /var/runtime /var/runtime +COPY --from=0 /var/lang /var/lang +COPY --from=0 /var/rapid /var/rapid # Add these as a separate layer as they get updated frequently -RUN pip install -U aws-lambda-builders==0.9.0 aws-sam-cli==0.53.0 awscli boto3 --no-cache-dir +# The pipx workaround is due to https://github.com/pipxproject/pipx/issues/218 +RUN source /usr/local/pipx/shared/bin/activate && \ + pipx install awscli==1.* && \ + pipx install aws-lambda-builders==1.2.0 && \ + pipx install aws-sam-cli==1.15.0 CMD ["npm", "rebuild"] diff --git a/nodejs8.10/run/awslambda-mock.js b/nodejs8.10/run/awslambda-mock.js index aaeab76f..ca25a49e 100644 --- a/nodejs8.10/run/awslambda-mock.js +++ b/nodejs8.10/run/awslambda-mock.js @@ -21,8 +21,8 @@ var MEM_SIZE = process.env.AWS_LAMBDA_FUNCTION_MEMORY_SIZE || '1536' var TIMEOUT = process.env.AWS_LAMBDA_FUNCTION_TIMEOUT || '300' var REGION = process.env.AWS_REGION || process.env.AWS_DEFAULT_REGION || 'us-east-1' var ACCOUNT_ID = process.env.AWS_ACCOUNT_ID || randomAccountId() -var ACCESS_KEY_ID = process.env.AWS_ACCESS_KEY_ID || 'SOME_ACCESS_KEY_ID' -var SECRET_ACCESS_KEY = process.env.AWS_SECRET_ACCESS_KEY || 'SOME_SECRET_ACCESS_KEY' +var ACCESS_KEY_ID = process.env.AWS_ACCESS_KEY_ID +var SECRET_ACCESS_KEY = process.env.AWS_SECRET_ACCESS_KEY var SESSION_TOKEN = process.env.AWS_SESSION_TOKEN var INVOKED_ARN = process.env.AWS_LAMBDA_FUNCTION_INVOKED_ARN || arn(REGION, ACCOUNT_ID, FN_NAME) var TRACE_ID = process.env._X_AMZN_TRACE_ID diff --git a/package-lock.json b/package-lock.json deleted file mode 100644 index fb3fd99b..00000000 --- a/package-lock.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "name": "docker-lambda", - "version": "0.15.3", - "lockfileVersion": 1, - "requires": true, - "dependencies": { - "should": { - "version": "8.4.0", - "resolved": "https://registry.npmjs.org/should/-/should-8.4.0.tgz", - "integrity": "sha1-XmCInT5kS73Tl6MM00+tKPz5C8A=", - "dev": true, - "requires": { - "should-equal": "0.8.0", - "should-format": "0.3.2", - "should-type": "0.2.0" - } - }, - "should-equal": { - "version": "0.8.0", - "resolved": "https://registry.npmjs.org/should-equal/-/should-equal-0.8.0.tgz", - "integrity": "sha1-o/BXMv9FusG3ukEvhAiFaBlkEpk=", - "dev": true, - "requires": { - "should-type": "0.2.0" - } - }, - "should-format": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/should-format/-/should-format-0.3.2.tgz", - "integrity": "sha1-pZgx4Bot3uFJkRvHFIvlyAMZ4f8=", - "dev": true, - "requires": { - "should-type": "0.2.0" - } - }, - "should-type": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/should-type/-/should-type-0.2.0.tgz", - "integrity": "sha1-ZwfvlVKdmJ3MCY/gdTqx+RNrt/Y=", - "dev": true - } - } -} diff --git a/provided.al2/build/Dockerfile b/provided.al2/build/Dockerfile new file mode 100644 index 00000000..214706da --- /dev/null +++ b/provided.al2/build/Dockerfile @@ -0,0 +1,12 @@ +FROM lambci/lambda:provided.al2 + +FROM lambci/lambda-base-2:build + +COPY --from=0 /var/runtime /var/runtime +COPY --from=0 /var/lang /var/lang +COPY --from=0 /var/rapid /var/rapid + +# Add these as a separate layer as they get updated frequently +RUN pipx install awscli==1.* && \ + pipx install aws-lambda-builders==1.2.0 && \ + pipx install aws-sam-cli==1.15.0 diff --git a/provided.al2/run/Dockerfile b/provided.al2/run/Dockerfile new file mode 100644 index 00000000..19e39287 --- /dev/null +++ b/provided.al2/run/Dockerfile @@ -0,0 +1,13 @@ +FROM lambci/lambda:provided + + +FROM lambci/lambda-base-2 + +ENV PATH=/var/lang/bin:$PATH \ + LD_LIBRARY_PATH=/var/lang/lib:$LD_LIBRARY_PATH + +COPY --from=0 /var/runtime/init /var/runtime/init + +USER sbx_user1051 + +ENTRYPOINT ["/var/runtime/init"] diff --git a/provided/build/Dockerfile b/provided/build/Dockerfile index ec3bf89d..47474a12 100644 --- a/provided/build/Dockerfile +++ b/provided/build/Dockerfile @@ -1,4 +1,14 @@ +FROM lambci/lambda:provided + FROM lambci/lambda-base:build +COPY --from=0 /var/runtime /var/runtime +COPY --from=0 /var/lang /var/lang +COPY --from=0 /var/rapid /var/rapid + # Add these as a separate layer as they get updated frequently -RUN pip install -U aws-lambda-builders==0.9.0 aws-sam-cli==0.53.0 awscli boto3 --no-cache-dir +# The pipx workaround is due to https://github.com/pipxproject/pipx/issues/218 +RUN source /usr/local/pipx/shared/bin/activate && \ + pipx install awscli==1.* && \ + pipx install aws-lambda-builders==1.2.0 && \ + pipx install aws-sam-cli==1.15.0 diff --git a/provided/run/go.mod b/provided/run/go.mod index d5e3372d..28c72849 100644 --- a/provided/run/go.mod +++ b/provided/run/go.mod @@ -6,4 +6,4 @@ require ( github.com/rjeczalik/notify v0.9.2 ) -go 1.14 +go 1.15 diff --git a/provided/run/init.go b/provided/run/init.go index d2f33d37..62cdff6a 100644 --- a/provided/run/init.go +++ b/provided/run/init.go @@ -43,10 +43,10 @@ var watchMode = os.Getenv("DOCKER_LAMBDA_WATCH") != "" var curState = "STATE_INIT" var transitions = map[string]map[string]bool{ - "STATE_INIT_ERROR": map[string]bool{"STATE_INIT": true}, - "STATE_INVOKE_NEXT": map[string]bool{"STATE_INIT": true, "STATE_INVOKE_NEXT": true, "STATE_INVOKE_RESPONSE": true, "STATE_INVOKE_ERROR": true}, - "STATE_INVOKE_RESPONSE": map[string]bool{"STATE_INVOKE_NEXT": true}, - "STATE_INVOKE_ERROR": map[string]bool{"STATE_INVOKE_NEXT": true}, + "STATE_INIT_ERROR": {"STATE_INIT": true}, + "STATE_INVOKE_NEXT": {"STATE_INIT": true, "STATE_INVOKE_NEXT": true, "STATE_INVOKE_RESPONSE": true, "STATE_INVOKE_ERROR": true}, + "STATE_INVOKE_RESPONSE": {"STATE_INVOKE_NEXT": true}, + "STATE_INVOKE_ERROR": {"STATE_INVOKE_NEXT": true}, } var acceptedResponse = &statusResponse{Status: "OK", HTTPStatusCode: 202} @@ -262,8 +262,8 @@ func ensureBootstrapIsRunning(context *mockLambdaContext) error { return fmt.Errorf("Couldn't find valid bootstrap(s): [/var/task/bootstrap /opt/bootstrap]") } - awsAccessKey := getEnv("AWS_ACCESS_KEY", getEnv("AWS_ACCESS_KEY_ID", "SOME_ACCESS_KEY_ID")) - awsSecretKey := getEnv("AWS_SECRET_KEY", getEnv("AWS_SECRET_ACCESS_KEY", "SOME_SECRET_ACCESS_KEY")) + awsAccessKey := getEnv("AWS_ACCESS_KEY", os.Getenv("AWS_ACCESS_KEY_ID")) + awsSecretKey := getEnv("AWS_SECRET_KEY", os.Getenv("AWS_SECRET_ACCESS_KEY")) awsSessionToken := getEnv("AWS_SESSION_TOKEN", os.Getenv("AWS_SECURITY_TOKEN")) bootstrapCmd.Env = append(os.Environ(), @@ -342,9 +342,32 @@ func waitForContext(context *mockLambdaContext) { } func addAPIRoutes(r *chi.Mux) *chi.Mux { + r.Options("/*", func(w http.ResponseWriter, r *http.Request) { + if r.Header.Get("Origin") == "" { + w.WriteHeader(403) + return + } + w.Header().Set("x-amzn-requestid", fakeGUID()) + w.Header().Set("access-control-allow-origin", "*") + w.Header().Set("access-control-expose-headers", "x-amzn-RequestId,x-amzn-ErrorType,x-amzn-ErrorMessage,Date,x-amz-log-result,x-amz-function-error") + w.Header().Set("access-control-max-age", "172800") + if r.Header.Get("Access-Control-Request-Headers") != "" { + w.Header().Set("access-control-allow-headers", r.Header.Get("Access-Control-Request-Headers")) + } + if r.Header.Get("Access-Control-Request-Method") != "" { + w.Header().Set("access-control-allow-methods", r.Header.Get("Access-Control-Request-Method")) + } + w.WriteHeader(200) + }) + r.Post("/2015-03-31/functions/{function}/invocations", func(w http.ResponseWriter, r *http.Request) { context := newContext() + if r.Header.Get("Origin") != "" { + w.Header().Set("access-control-allow-origin", "*") + w.Header().Set("access-control-expose-headers", "x-amzn-RequestId,x-amzn-ErrorType,x-amzn-ErrorMessage,Date,x-amz-log-result,x-amz-function-error") + } + if r.Header.Get("X-Amz-Invocation-Type") != "" { context.InvocationType = r.Header.Get("X-Amz-Invocation-Type") } @@ -955,7 +978,7 @@ func (mc *mockLambdaContext) LogEndRequest() { "Billed Duration: %.f ms\t"+ "Memory Size: %s MB\t"+ "Max Memory Used: %d MB\t", - mc.RequestID, diffMs, math.Ceil(diffMs/100)*100, mc.MemSize, mc.MaxMem)) + mc.RequestID, diffMs, math.Ceil(diffMs), mc.MemSize, mc.MaxMem)) } type invokeResponse struct { diff --git a/python2.7/build/Dockerfile b/python2.7/build/Dockerfile index dc20f283..520142fd 100644 --- a/python2.7/build/Dockerfile +++ b/python2.7/build/Dockerfile @@ -1,14 +1,17 @@ +FROM lambci/lambda:python2.7 + FROM lambci/lambda-base:build ENV AWS_EXECUTION_ENV=AWS_Lambda_python2.7 -RUN rm -rf /var/runtime /var/lang && \ - curl https://lambci.s3.amazonaws.com/fs/python2.7.tgz | tar -zx -C / +COPY --from=0 /var/runtime /var/runtime +COPY --from=0 /var/lang /var/lang +COPY --from=0 /var/rapid /var/rapid # Add these as a separate layer as they get updated frequently -RUN curl --silent --show-error --retry 5 https://bootstrap.pypa.io/get-pip.py | python && \ +RUN curl --silent --show-error --retry 5 https://bootstrap.pypa.io/2.7/get-pip.py | python && \ pip install -U 'virtualenv>=16.0.0,<20.0.0' pipenv wheel --no-cache-dir && \ - curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/1.0.9/get-poetry.py | POETRY_VERSION=1.0.9 python && \ + curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/1.1.4/get-poetry.py | POETRY_VERSION=1.1.4 python && \ pip install -U awscli boto3 aws-sam-cli==0.22.0 aws-lambda-builders==0.4.0 --no-cache-dir ENV PATH=/root/.poetry/bin:$PATH diff --git a/python2.7/run/runtime_mock.py b/python2.7/run/runtime_mock.py index 59f428cf..a52ffe80 100644 --- a/python2.7/run/runtime_mock.py +++ b/python2.7/run/runtime_mock.py @@ -38,8 +38,8 @@ DEADLINE_MS = int(time.time() * 1000) + int(os.environ.get('AWS_LAMBDA_FUNCTION_TIMEOUT', '300')) REGION = os.environ.get('AWS_REGION', os.environ.get('AWS_DEFAULT_REGION', 'us-east-1')) ACCOUNT_ID = os.environ.get('AWS_ACCOUNT_ID', random.randint(100000000000, 999999999999)) -ACCESS_KEY_ID = os.environ.get('AWS_ACCESS_KEY_ID', 'SOME_ACCESS_KEY_ID') -SECRET_ACCESS_KEY = os.environ.get('AWS_SECRET_ACCESS_KEY', 'SOME_SECRET_ACCESS_KEY') +ACCESS_KEY_ID = os.environ.get('AWS_ACCESS_KEY_ID', None) +SECRET_ACCESS_KEY = os.environ.get('AWS_SECRET_ACCESS_KEY', None) SESSION_TOKEN = os.environ.get('AWS_SESSION_TOKEN', None) INVOKEID = str(uuid.uuid4()) diff --git a/python3.6/build/Dockerfile b/python3.6/build/Dockerfile index d458b5ee..3da42ff5 100644 --- a/python3.6/build/Dockerfile +++ b/python3.6/build/Dockerfile @@ -1,13 +1,19 @@ +FROM lambci/lambda:python3.6 + FROM lambci/lambda-base:build ENV PATH=/var/lang/bin:$PATH \ LD_LIBRARY_PATH=/var/lang/lib:$LD_LIBRARY_PATH \ AWS_EXECUTION_ENV=AWS_Lambda_python3.6 \ - PKG_CONFIG_PATH=/var/lang/lib/pkgconfig:/usr/lib64/pkgconfig:/usr/share/pkgconfig + PKG_CONFIG_PATH=/var/lang/lib/pkgconfig:/usr/lib64/pkgconfig:/usr/share/pkgconfig \ + PIPX_BIN_DIR=/var/lang/bin \ + PIPX_HOME=/var/lang/pipx + +COPY --from=0 /var/runtime /var/runtime +COPY --from=0 /var/lang /var/lang +COPY --from=0 /var/rapid /var/rapid -RUN rm -rf /var/runtime /var/lang && \ - export PYTHON_VERSION=3.6.10 && \ - curl https://lambci.s3.amazonaws.com/fs/python3.6.tgz | tar -xz -C / && \ +RUN export PYTHON_VERSION=3.6.12 && \ sed -i '/^prefix=/c\prefix=/var/lang' /var/lang/lib/pkgconfig/python-3.6.pc && \ curl https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}.tar.xz | tar -xJ && \ cd Python-${PYTHON_VERSION} && \ @@ -18,8 +24,10 @@ RUN rm -rf /var/runtime /var/lang && \ # Add these as a separate layer as they get updated frequently RUN pip install -U pip setuptools wheel --no-cache-dir && \ - pip install -U virtualenv pipenv --no-cache-dir && \ - curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/1.0.9/get-poetry.py | POETRY_VERSION=1.0.9 python3 && \ - pip install -U aws-lambda-builders==0.9.0 aws-sam-cli==0.53.0 awscli boto3 --no-cache-dir - -ENV PATH=/root/.poetry/bin:$PATH + pip install pipx --no-cache-dir && \ + pipx install virtualenv && \ + pipx install pipenv && \ + pipx install poetry==1.1.4 && \ + pipx install awscli==1.* && \ + pipx install aws-lambda-builders==1.2.0 && \ + pipx install aws-sam-cli==1.15.0 diff --git a/python3.6/run/runtime_mock.py b/python3.6/run/runtime_mock.py index 59f428cf..a52ffe80 100644 --- a/python3.6/run/runtime_mock.py +++ b/python3.6/run/runtime_mock.py @@ -38,8 +38,8 @@ DEADLINE_MS = int(time.time() * 1000) + int(os.environ.get('AWS_LAMBDA_FUNCTION_TIMEOUT', '300')) REGION = os.environ.get('AWS_REGION', os.environ.get('AWS_DEFAULT_REGION', 'us-east-1')) ACCOUNT_ID = os.environ.get('AWS_ACCOUNT_ID', random.randint(100000000000, 999999999999)) -ACCESS_KEY_ID = os.environ.get('AWS_ACCESS_KEY_ID', 'SOME_ACCESS_KEY_ID') -SECRET_ACCESS_KEY = os.environ.get('AWS_SECRET_ACCESS_KEY', 'SOME_SECRET_ACCESS_KEY') +ACCESS_KEY_ID = os.environ.get('AWS_ACCESS_KEY_ID', None) +SECRET_ACCESS_KEY = os.environ.get('AWS_SECRET_ACCESS_KEY', None) SESSION_TOKEN = os.environ.get('AWS_SESSION_TOKEN', None) INVOKEID = str(uuid.uuid4()) diff --git a/python3.7/build/Dockerfile b/python3.7/build/Dockerfile index dcada8e1..98b20835 100644 --- a/python3.7/build/Dockerfile +++ b/python3.7/build/Dockerfile @@ -1,17 +1,24 @@ +FROM lambci/lambda:python3.7 + FROM lambci/lambda-base:build ENV PATH=/var/lang/bin:$PATH \ LD_LIBRARY_PATH=/var/lang/lib:$LD_LIBRARY_PATH \ AWS_EXECUTION_ENV=AWS_Lambda_python3.7 \ - PKG_CONFIG_PATH=/var/lang/lib/pkgconfig:/usr/lib64/pkgconfig:/usr/share/pkgconfig + PKG_CONFIG_PATH=/var/lang/lib/pkgconfig:/usr/lib64/pkgconfig:/usr/share/pkgconfig \ + PIPX_BIN_DIR=/var/lang/bin \ + PIPX_HOME=/var/lang/pipx -RUN rm -rf /var/runtime /var/lang /var/rapid && \ - curl https://lambci.s3.amazonaws.com/fs/python3.7.tgz | tar -zx -C / +COPY --from=0 /var/runtime /var/runtime +COPY --from=0 /var/lang /var/lang +COPY --from=0 /var/rapid /var/rapid # Add these as a separate layer as they get updated frequently RUN pip install -U pip setuptools wheel --no-cache-dir && \ - pip install -U virtualenv pipenv --no-cache-dir && \ - curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/1.0.9/get-poetry.py | POETRY_VERSION=1.0.9 python3 && \ - pip install -U aws-lambda-builders==0.9.0 aws-sam-cli==0.53.0 awscli boto3 --no-cache-dir - -ENV PATH=/root/.poetry/bin:$PATH + pip install pipx --no-cache-dir && \ + pipx install virtualenv && \ + pipx install pipenv && \ + pipx install poetry==1.1.4 && \ + pipx install awscli==1.* && \ + pipx install aws-lambda-builders==1.2.0 && \ + pipx install aws-sam-cli==1.15.0 diff --git a/python3.8/build/Dockerfile b/python3.8/build/Dockerfile index dcf83d6b..ecf9ab00 100644 --- a/python3.8/build/Dockerfile +++ b/python3.8/build/Dockerfile @@ -1,17 +1,24 @@ +FROM lambci/lambda:python3.8 + FROM lambci/lambda-base-2:build ENV PATH=/var/lang/bin:$PATH \ LD_LIBRARY_PATH=/var/lang/lib:$LD_LIBRARY_PATH \ AWS_EXECUTION_ENV=AWS_Lambda_python3.8 \ - PKG_CONFIG_PATH=/var/lang/lib/pkgconfig:/usr/lib64/pkgconfig:/usr/share/pkgconfig + PKG_CONFIG_PATH=/var/lang/lib/pkgconfig:/usr/lib64/pkgconfig:/usr/share/pkgconfig \ + PIPX_BIN_DIR=/var/lang/bin \ + PIPX_HOME=/var/lang/pipx -RUN rm -rf /var/runtime /var/lang /var/rapid && \ - curl https://lambci.s3.amazonaws.com/fs/python3.8.tgz | tar -zx -C / +COPY --from=0 /var/runtime /var/runtime +COPY --from=0 /var/lang /var/lang +COPY --from=0 /var/rapid /var/rapid # Add these as a separate layer as they get updated frequently RUN pip install -U pip setuptools wheel --no-cache-dir && \ - pip install -U virtualenv pipenv --no-cache-dir && \ - curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/1.0.9/get-poetry.py | POETRY_VERSION=1.0.9 python3 && \ - pip install -U aws-lambda-builders==0.9.0 aws-sam-cli==0.53.0 awscli boto3 --no-cache-dir - -ENV PATH=/root/.poetry/bin:$PATH + pip install pipx --no-cache-dir && \ + pipx install virtualenv && \ + pipx install pipenv && \ + pipx install poetry==1.1.4 && \ + pipx install awscli==1.* && \ + pipx install aws-lambda-builders==1.2.0 && \ + pipx install aws-sam-cli==1.15.0 diff --git a/ruby2.5/build/Dockerfile b/ruby2.5/build/Dockerfile index 79bfcec0..439b202b 100644 --- a/ruby2.5/build/Dockerfile +++ b/ruby2.5/build/Dockerfile @@ -1,3 +1,5 @@ +FROM lambci/lambda:ruby2.5 + FROM lambci/lambda-base:build ENV PATH=/var/lang/bin:$PATH \ @@ -5,12 +7,18 @@ ENV PATH=/var/lang/bin:$PATH \ AWS_EXECUTION_ENV=AWS_Lambda_ruby2.5 \ GEM_HOME=/var/runtime \ GEM_PATH=/var/task/vendor/bundle/ruby/2.5.0:/opt/ruby/gems/2.5.0:/var/lang/lib/ruby/gems/2.5.0 \ - RUBYLIB=/var/task:/var/runtime/lib:/opt/ruby/lib + RUBYLIB=/var/task:/var/runtime/lib:/opt/ruby/lib \ + BUNDLE_SILENCE_ROOT_WARNING=1 -RUN rm -rf /var/runtime /var/lang /var/rapid && \ - curl https://lambci.s3.amazonaws.com/fs/ruby2.5.tgz | tar -zx -C / +COPY --from=0 /var/runtime /var/runtime +COPY --from=0 /var/lang /var/lang +COPY --from=0 /var/rapid /var/rapid # Add these as a separate layer as they get updated frequently -RUN gem update --system --no-document && \ - gem install --no-document bundler -v '~> 2.1' && \ - pip install -U aws-lambda-builders==0.9.0 aws-sam-cli==0.53.0 awscli boto3 --no-cache-dir +# The pipx workaround is due to https://github.com/pipxproject/pipx/issues/218 +RUN source /usr/local/pipx/shared/bin/activate && \ + pipx install awscli==1.* && \ + pipx install aws-lambda-builders==1.2.0 && \ + pipx install aws-sam-cli==1.15.0 && \ + gem update --system --no-document && \ + gem install --no-document bundler -v '~> 2.1' diff --git a/ruby2.7/build/Dockerfile b/ruby2.7/build/Dockerfile index 8cb421e9..c0fbeef3 100644 --- a/ruby2.7/build/Dockerfile +++ b/ruby2.7/build/Dockerfile @@ -1,3 +1,5 @@ +FROM lambci/lambda:ruby2.7 + FROM lambci/lambda-base-2:build ENV PATH=/var/lang/bin:$PATH \ @@ -5,12 +7,16 @@ ENV PATH=/var/lang/bin:$PATH \ AWS_EXECUTION_ENV=AWS_Lambda_ruby2.7 \ GEM_HOME=/var/runtime \ GEM_PATH=/var/task/vendor/bundle/ruby/2.7.0:/opt/ruby/gems/2.7.0:/var/lang/lib/ruby/gems/2.7.0 \ - RUBYLIB=/var/task:/var/runtime/lib:/opt/ruby/lib + RUBYLIB=/var/task:/var/runtime/lib:/opt/ruby/lib \ + BUNDLE_SILENCE_ROOT_WARNING=1 -RUN rm -rf /var/runtime /var/lang /var/rapid && \ - curl https://lambci.s3.amazonaws.com/fs/ruby2.7.tgz | tar -zx -C / +COPY --from=0 /var/runtime /var/runtime +COPY --from=0 /var/lang /var/lang +COPY --from=0 /var/rapid /var/rapid # Add these as a separate layer as they get updated frequently -RUN gem update --system --no-document && \ - gem install --no-document bundler -v '~> 2.1' && \ - pip install -U aws-lambda-builders==0.9.0 aws-sam-cli==0.53.0 awscli boto3 --no-cache-dir +RUN pipx install awscli==1.* && \ + pipx install aws-lambda-builders==1.2.0 && \ + pipx install aws-sam-cli==1.15.0 && \ + gem update --system --no-document && \ + gem install --no-document bundler -v '~> 2.1'