Skip to content

Commit 6410d2a

Browse files
Merge pull request #25 from segmentio/yolken-create-lambda-image
Add lambda image
2 parents 804491f + af86236 commit 6410d2a

File tree

5 files changed

+55
-6
lines changed

5 files changed

+55
-6
lines changed

.circleci/config.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,24 @@ jobs:
5353
pip3 install awscli==1.16.292
5454
$(aws ecr get-login --no-include-email --region ${AWS_REGION} --registry-ids ${AWS_ACCOUNT_ID})
5555
- run:
56-
name: Build and push image
56+
name: Build and push main image
5757
command: |
5858
export SHORT_GIT_SHA=$(echo ${CIRCLE_SHA1} | cut -c -7)
5959
docker build \
6060
-t ${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_REGION}.amazonaws.com/kubeapply:${SHORT_GIT_SHA} \
6161
--build-arg VERSION_REF=${SHORT_GIT_SHA} \
6262
.
6363
docker push ${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_REGION}.amazonaws.com/kubeapply:${SHORT_GIT_SHA}
64+
- run:
65+
name: Build and push lambda image
66+
command: |
67+
export SHORT_GIT_SHA=$(echo ${CIRCLE_SHA1} | cut -c -7)
68+
docker build \
69+
-f Dockerfile.lambda \
70+
-t ${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_REGION}.amazonaws.com/kubeapply-lambda:${SHORT_GIT_SHA} \
71+
--build-arg VERSION_REF=${SHORT_GIT_SHA} \
72+
.
73+
docker push ${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_REGION}.amazonaws.com/kubeapply-lambda:${SHORT_GIT_SHA}
6474
6575
workflows:
6676
version: 2

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
Dockerfile
2+
Dockerfile.lambda
23
build
34
deps
45
*zip

Dockerfile

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ ENV SRC github.com/segmentio/kubeapply
88

99
RUN apt-get update && apt-get install --yes \
1010
curl \
11-
libbtrfs-dev \
12-
libdevmapper-dev \
1311
wget
1412

1513
COPY . /go/src/${SRC}
@@ -29,7 +27,6 @@ FROM ubuntu:18.04
2927
RUN apt-get update && apt-get install --yes \
3028
curl \
3129
git \
32-
libdevmapper-dev \
3330
python3 \
3431
python3-pip
3532

Dockerfile.lambda

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Fetch or build all required binaries
2+
FROM golang:1.14 as builder
3+
4+
ARG VERSION_REF
5+
RUN test -n "${VERSION_REF}"
6+
7+
ENV SRC github.com/segmentio/kubeapply
8+
9+
RUN apt-get update && apt-get install --yes \
10+
curl \
11+
wget
12+
13+
COPY . /go/src/${SRC}
14+
RUN cd /usr/local/bin && /go/src/${SRC}/scripts/pull-deps.sh
15+
16+
WORKDIR /go/src/${SRC}
17+
18+
ENV CGO_ENABLED=1
19+
ENV GO111MODULE=on
20+
21+
RUN make kubeapply VERSION_REF=${VERSION_REF} && \
22+
cp build/kubeapply /usr/local/bin
23+
RUN make kubeapply-lambda VERSION_REF=${VERSION_REF} && \
24+
cp build/kubeapply-lambda /usr/local/bin
25+
26+
# Copy into final image
27+
FROM public.ecr.aws/lambda/go:1
28+
29+
RUN yum install -y git
30+
31+
RUN curl -O https://bootstrap.pypa.io/get-pip.py && python3 get-pip.py
32+
RUN pip3 install awscli
33+
34+
COPY --from=builder /usr/local/bin/aws-iam-authenticator /usr/local/bin
35+
COPY --from=builder /usr/local/bin/helm /usr/local/bin
36+
COPY --from=builder /usr/local/bin/kubeval /usr/local/bin
37+
COPY --from=builder /usr/local/bin/kubectl /usr/local/bin
38+
COPY --from=builder /usr/local/bin/kubeapply /usr/local/bin
39+
COPY --from=builder /usr/local/bin/kubeapply-lambda /usr/local/bin
40+
41+
CMD [ "/usr/local/bin/kubeapply-lambda" ]

data/data.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)