-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
103 lines (76 loc) · 3.21 KB
/
Dockerfile
File metadata and controls
103 lines (76 loc) · 3.21 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
FROM public.ecr.aws/lambda/provided:al2023 AS builder
ARG HTTP_CLI_VERSION=v1.1.0
RUN dnf install -y unzip && \
dnf clean all
# Download http-cli
RUN curl \
-L "https://github.com/ql4b/http-cli/archive/refs/tags/${HTTP_CLI_VERSION}.zip" \
-o http-cli.zip && \
unzip http-cli.zip && \
mkdir -p /http-cli-bin && \
mv http-cli-${HTTP_CLI_VERSION#v}/http-cli /http-cli-bin/ && \
chmod +x /http-cli-bin/http-cli && \
rm -rf http-cli.zip http-cli-${HTTP_CLI_VERSION#v}
LABEL org.opencontainers.image.http_cli_version="${HTTP_CLI_VERSION}"
# base: minimal runtime setup with jq
FROM public.ecr.aws/lambda/provided:al2023 AS base
ARG VERSION=develop
ARG HTTP_CLI_VERSION
# Install only runtime dependencies
RUN dnf install -y jq && \
dnf clean all && \
rm -rf /var/cache/dnf
# Copy http-cli
COPY --from=builder /http-cli-bin/http-cli /var/task/bin/http-cli
ENV PATH="/var/task/bin:${PATH}"
COPY runtime/bootstrap /var/runtime/bootstrap
RUN chmod +x /var/runtime/bootstrap
WORKDIR /var/task
COPY task/handler.sh handler.sh
LABEL org.opencontainers.image.source="https://github.com/ql4b/lambda-shell-runtime"
LABEL org.opencontainers.image.version="${VERSION}"
LABEL org.opencontainers.image.title="Lambda Shell Runtime"
LABEL org.opencontainers.image.description="Custom AWS Lambda runtime for executing Bash functions as serverless applications"
LABEL org.opencontainers.image.url="https://github.com/ql4b/lambda-shell-runtime"
LABEL org.opencontainers.image.documentation="https://github.com/ql4b/lambda-shell-runtime#readme"
LABEL org.opencontainers.image.vendor="QL4B"
LABEL org.opencontainers.image.licenses="MIT"
LABEL org.opencontainers.image.authors="QL4B <https://github.com/ql4b>"
LABEL maintainer="QL4B <https://github.com/ql4b>"
# tiny: add lambda helper functions
FROM ghcr.io/ql4b/lambda-shell-runtime:base AS tiny
ARG VERSION
ARG HTTP_CLI_VERSION
COPY task/helpers.sh helpers.sh
LABEL org.opencontainers.image.title="lambda-shell-runtime:tiny"
LABEL org.opencontainers.image.version="${VERSION}"
LABEL org.opencontainers.image.http_cli_version="${HTTP_CLI_VERSION}"
# micro: includes awscurl
FROM tiny AS micro
ARG VERSION
ARG HTTP_CLI_VERSION
RUN dnf install -y python3 && \
dnf clean all && \
rm -rf /var/cache/dnf
COPY --from=ghcr.io/ql4b/lambda-shell-runtime:awscurl-installer /tmp/awscurl /var/task/aws
RUN rm -rf \
/var/task/aws/__pycache__ \
/var/task/aws/*.dist-info \
/var/task/aws/**/__pycache__
ENV PYTHONPATH="/var/task/aws"
RUN mkdir -p /var/task/bin && \
printf '#!/bin/sh\nexport PYTHONPATH=/var/task/aws\nexec python3 -m awscurl.awscurl "$@"\n' > /var/task/bin/awscurl && \
chmod +x /var/task/bin/awscurl
LABEL org.opencontainers.image.title="lambda-shell-runtime:micro"
LABEL org.opencontainers.image.version="${VERSION}"
LABEL org.opencontainers.image.http_cli_version="${HTTP_CLI_VERSION}"
# full: includes aws-cli for complete AWS functionality
FROM tiny AS full
ARG VERSION
ARG HTTP_CLI_VERSION
RUN dnf install -y awscli-2 && \
dnf clean all && \
rm -rf /var/cache/dnf
LABEL org.opencontainers.image.title="lambda-shell-runtime:full"
LABEL org.opencontainers.image.version="${VERSION}"
LABEL org.opencontainers.image.http_cli_version="${HTTP_CLI_VERSION}"