generated from DimensionDev/aws_lambda_rust_template
-
Notifications
You must be signed in to change notification settings - Fork 6
/
lambda.Dockerfile
32 lines (21 loc) · 938 Bytes
/
lambda.Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# Build Lambda Docker image
FROM amazonlinux:2 AS builder
WORKDIR /app
RUN yum install -y postgresql-devel openssl-devel && yum groupinstall -y "Development Tools"
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --profile minimal --default-toolchain stable -y && \
source ~/.cargo/env
ADD Cargo.toml .
ADD Cargo.lock .
RUN source ~/.cargo/env && cargo fetch
ARG COMMIT=""
ARG NOW=""
ENV RELATION_SERVER_BUILT_AT=${NOW}
ENV RELATION_SERVER_REVISION=${COMMIT}
ADD . .
RUN source ~/.cargo/env && cargo build --release --example lambda
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
FROM public.ecr.aws/lambda/provided:al2 AS runner
LABEL maintainer="Nyk Ma <nykma@mask.io>"
WORKDIR /app
RUN yum install -y postgresql-devel openssl-devel && yum clean all && rm -rf /var/cache/yum
COPY --from=builder /app/target/release/examples/lambda ${LAMBDA_RUNTIME_DIR}/bootstrap