a build env for Rustlang applications targeting the aws lambda provided runtime
356
The DockerHub repo https://hub.docker.com/r/softprops/lambda-rust isn't (so far) updated with the newer rust releases. Some of our serverless lambdas at PathLit.io run on rust so we needed this amazing work from Softprops up to date. We basically forked the repo (so can you!) https://github.com/softprops/lambda-rust and we release it to two channels: our private GitHub Packages repo and this public DockerHub repo, since we build it.
The only variation we made in the Dockerfile is to add two packages - openssh-client and git. Then we add the GitHub public keys under /root/.ssh/ as later in our workflows we need to pull some private repositories at buildtime (we use the serverless-rust plugin with a few hooks configured). See the Dockerfile.yml below.
#
# This Dockerfile sole purpose is to compile and package AWS lambda functions
# using the rust runtime within a serverless framework project.
#
# https://github.com/lambci/docker-lambda#documentation
FROM lambci/lambda:build-provided.al2
ARG RUST_VERSION=1.52.1
RUN yum install -y jq openssl-devel openssh-client git
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs \
| CARGO_HOME=/cargo RUSTUP_HOME=/rustup sh -s -- -y --profile minimal --default-toolchain $RUST_VERSION
ADD build.sh /usr/local/bin/
VOLUME ["/code"]
WORKDIR /code
# This is necessary to prevent the "git clone" operation from failing
# with an "unknown host key" error.
RUN mkdir -m 700 /root/.ssh
RUN touch -m 600 /root/.ssh/known_hosts
RUN ssh-keyscan github.com > /root/.ssh/known_hosts
# This is as far as we go here, the rest is done late
ENTRYPOINT ["/usr/local/bin/build.sh"]
And a big thank you to Softprops for creating both image and serverless plugin.
Content type
Image
Digest
Size
804 MB
Last updated
about 4 years ago
Requires Docker Desktop 4.37.1 or later.