softprops / lambda-rust

🐳 🦀 a dockerized lambda build env for rust applications
MIT License
162 stars 76 forks source link

I'm looking for version rust-1.51.0 #98

Open hrishikeshparanjape opened 3 years ago

nicolas-pathlit commented 3 years ago

We had the same issue, ended up building ourselves and pushing to a public dockerhub repo. https://hub.docker.com/r/pathlit/lambda-rust We started doing this only with the 1.52.1 though. The tests are run prior push. The only modification we did was to add openssh-client and git for yum to install. Then we add the Github public key under root/.ssh as we later in our flow need to pull some repos while crafting our lambdas with the serverless-rust plugin (pull via a hook). See 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"]

Alternatively you can definitely fork the repo, configure the action and run it yourself it works great thank to @softprops very good code.