Skip to content

Commit 700c922

Browse files
authored
Merge pull request #77 from segmentio/mckern/please-please-please-let-me-get-what-i-want
Use AL2 build image instead of golang/debian
2 parents 87f3848 + 533b7d6 commit 700c922

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

Dockerfile.lambda

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,32 @@
11
# Fetch or build all required binaries
2-
FROM golang:1.21-bookworm as builder
2+
3+
FROM public.ecr.aws/lambda/provided:al2 as builder
4+
5+
ADD https://go.dev/dl/go1.21.5.linux-amd64.tar.gz /tmp/go1.21.5.linux-amd64.tar.gz
36

47
ARG VERSION_REF
58
RUN test -n "${VERSION_REF}"
69

710
ENV SRC github.com/segmentio/kubeapply
11+
ENV PATH=/usr/local/go/bin:/root/go/bin:/var/lang/bin:/usr/local/bin:/usr/bin/:/bin:/opt/bin
812

9-
RUN apt-get update && apt-get install --no-install-recommends --yes \
13+
RUN yum install -y \
1014
curl \
15+
git \
16+
gzip \
17+
make \
18+
tar \
1119
unzip \
20+
which \
1221
wget
1322

1423
COPY . /go/src/${SRC}
15-
RUN cd /usr/local/bin && /go/src/${SRC}/scripts/pull-deps.sh
24+
25+
RUN cd /usr/local \
26+
&& tar xf /tmp/go1.21.5.linux-amd64.tar.gz \
27+
&& cd /usr/local/bin \
28+
&& go env \
29+
&& /go/src/${SRC}/scripts/pull-deps.sh
1630

1731
WORKDIR /go/src/${SRC}
1832

@@ -24,7 +38,7 @@ RUN make kubeapply-lambda VERSION_REF=${VERSION_REF} && \
2438
# Copy into final image from builder
2539
FROM public.ecr.aws/lambda/provided:al2
2640

27-
RUN yum install -y git unzip
41+
RUN yum install -y git unzip && yum clean all
2842

2943
# Not sure if awscli is needed for running lambda, but keeping it here for now
3044
RUN curl https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip -o awscliv2.zip \

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ ifndef VERSION_REF
22
VERSION_REF ?= $(shell git describe --tags --always --dirty="-dev")
33
endif
44

5-
LDFLAGS := -ldflags='-linkmode "external" -extldflags "-static" -s -w -X "main.VersionRef=$(VERSION_REF)"'
5+
LDFLAGS := -ldflags='-s -w -X "main.VersionRef=$(VERSION_REF)"'
66
export GOFLAGS := -trimpath
77

88
GOFILES = $(shell find . -iname '*.go' | grep -v -e vendor -e _modules -e _cache -e /data/)

0 commit comments

Comments
 (0)