-
Notifications
You must be signed in to change notification settings - Fork 16
/
Dockerfile.lambda
58 lines (43 loc) · 1.47 KB
/
Dockerfile.lambda
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
# Fetch or build all required binaries
FROM public.ecr.aws/lambda/provided:al2 as builder
ADD https://go.dev/dl/go1.21.5.linux-amd64.tar.gz /tmp/go1.21.5.linux-amd64.tar.gz
ARG VERSION_REF
RUN test -n "${VERSION_REF}"
ENV SRC github.com/segmentio/kubeapply
ENV PATH=/usr/local/go/bin:/root/go/bin:/var/lang/bin:/usr/local/bin:/usr/bin/:/bin:/opt/bin
RUN yum install -y \
curl \
git \
gzip \
make \
tar \
unzip \
which \
wget
COPY . /go/src/${SRC}
RUN cd /usr/local \
&& tar xf /tmp/go1.21.5.linux-amd64.tar.gz \
&& cd /usr/local/bin \
&& go env \
&& /go/src/${SRC}/scripts/pull-deps.sh
WORKDIR /go/src/${SRC}
RUN make kubeapply VERSION_REF=${VERSION_REF} && \
cp build/kubeapply /usr/local/bin
RUN make kubeapply-lambda VERSION_REF=${VERSION_REF} && \
cp build/kubeapply-lambda /usr/local/bin
# Copy into final image from builder
FROM public.ecr.aws/lambda/provided:al2
RUN yum install -y git unzip && yum clean all
# Not sure if awscli is needed for running lambda, but keeping it here for now
RUN curl https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip -o awscliv2.zip \
&& unzip awscliv2.zip \
&& ./aws/install \
&& rm -rf aws awscliv2.zip
COPY --from=builder \
/usr/local/bin/aws-iam-authenticator \
/usr/local/bin/helm \
/usr/local/bin/kubectl \
/usr/local/bin/kubeapply \
/usr/local/bin/
COPY --from=builder /usr/local/bin/kubeapply-lambda /kubeapply-lambda
ENTRYPOINT ["/kubeapply-lambda"]