11FROM public.ecr.aws/lambda/provided:al2023 AS builder
22
3- ARG HTTP_CLI_VERSION=v1.0.1
4-
53RUN dnf install -y unzip python3-pip findutils && \
64 dnf clean all
75
8- # Download http-cli
9- RUN --mount=type=secret,id=github_token \
10- curl -H "Authorization: token $(cat /run/secrets/github_token)" \
11- -L "https://github.com/ql4b/http-cli/archive/refs/tags/${HTTP_CLI_VERSION}.zip" \
12- -o http-cli.zip && \
13- unzip http-cli.zip && \
14- mkdir -p /http-cli-bin && \
15- mv http-cli-${HTTP_CLI_VERSION#v}/http-cli /http-cli-bin/ && \
16- chmod +x /http-cli-bin/http-cli && \
17- rm -rf http-cli.zip http-cli-${HTTP_CLI_VERSION#v}
18-
196RUN pip3 install --no-cache-dir --target /tmp/awscurl awscurl && \
207 find /tmp/awscurl -type d -name '__pycache__' -exec rm -rf {} + && \
218 find /tmp/awscurl -type f -name '*.pyc' -delete && \
229 find /tmp/awscurl -type d -name '*.dist-info' -exec rm -rf {} +
2310
2411# Stage 2: Runtime stage
25- FROM public.ecr.aws/ lambda/provided:al2023
12+ FROM lambda-shell-runtime:tiny AS micro
2613
2714# Install only runtime dependencies
2815RUN dnf install -y jq python3 && \
@@ -43,14 +30,4 @@ RUN mkdir -p /var/task/bin && \
4330 printf '#!/bin/sh\n export PYTHONPATH=/var/task/aws\n exec python3 -m awscurl.awscurl "$@"\n ' > /var/task/bin/awscurl && \
4431 chmod +x /var/task/bin/awscurl
4532
46- # Copy http-cli
47- COPY --from=builder /http-cli-bin/http-cli /var/task/bin/http-cli
48- ENV PATH="/var/task/bin:${PATH}"
49-
50- COPY runtime/bootstrap /var/runtime/bootstrap
51- RUN chmod +x /var/runtime/bootstrap
52-
53- WORKDIR /var/task
54-
55- COPY task/handler.sh handler.sh
56- COPY task/helpers.sh helpers.sh
33+ LABEL org.opencontainers.image.title="lambda-shell-runtime:micro"
0 commit comments