Created
March 27, 2022 12:12
-
-
Save dacci/d618fe1a0ae0397ab11c117b99d8a903 to your computer and use it in GitHub Desktop.
Dockerfiles to use Rust on AWS Lambda
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FROM rust:alpine AS builder | |
| RUN apk add --no-cache musl-dev | |
| WORKDIR /build | |
| COPY . . | |
| RUN cargo build --release | |
| FROM alpine | |
| WORKDIR /var/task | |
| COPY --from=builder /build/target/release/lambda-rs bootstrap | |
| ENTRYPOINT [ "/var/task/bootstrap" ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FROM public.ecr.aws/amazonlinux/amazonlinux:latest AS builder | |
| RUN yum install -y gcc | |
| RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y | |
| WORKDIR /build | |
| COPY . . | |
| RUN source $HOME/.cargo/env && cargo build --release | |
| FROM public.ecr.aws/lambda/provided:latest | |
| COPY --from=builder /build/target/release/lambda-rs ${LAMBDA_RUNTIME_DIR}/bootstrap | |
| CMD [ "" ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FROM rust:bullseye AS builder | |
| WORKDIR /build | |
| COPY . . | |
| RUN cargo build --release | |
| FROM debian:bullseye-slim | |
| WORKDIR /var/task | |
| COPY --from=builder /build/target/release/lambda-rs bootstrap | |
| ENTRYPOINT [ "/var/task/bootstrap" ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment