Skip to content

Commit ab73469

Browse files
authored
Merge pull request #75 from segmentio/mckern/shuffle-some-deck-chairs
Shuffle some deck chairs around a bit
2 parents 1893901 + ad94e29 commit ab73469

File tree

5 files changed

+42
-122
lines changed

5 files changed

+42
-122
lines changed

.buildkite/pipeline.yml

Lines changed: 0 additions & 27 deletions
This file was deleted.

Dockerfile.lambda

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# Fetch or build all required binaries
2-
FROM --platform=linux/amd64 golang:1.20 as builder
2+
FROM golang:1.21-bookworm as builder
33

44
ARG VERSION_REF
55
RUN test -n "${VERSION_REF}"
66

77
ENV SRC github.com/segmentio/kubeapply
88

9-
RUN apt-get update && apt-get install --yes \
9+
RUN apt-get update && apt-get install --no-install-recommends --yes \
1010
curl \
1111
unzip \
1212
wget
@@ -16,24 +16,21 @@ RUN cd /usr/local/bin && /go/src/${SRC}/scripts/pull-deps.sh
1616

1717
WORKDIR /go/src/${SRC}
1818

19-
ENV CGO_ENABLED=1
20-
ENV GO111MODULE=on
21-
2219
RUN make kubeapply VERSION_REF=${VERSION_REF} && \
2320
cp build/kubeapply /usr/local/bin
2421
RUN make kubeapply-lambda VERSION_REF=${VERSION_REF} && \
2522
cp build/kubeapply-lambda /usr/local/bin
2623

27-
# Copy into final image
24+
# Copy into final image from builder
2825
FROM public.ecr.aws/lambda/provided:al2
2926

3027
RUN yum install -y git unzip
3128

3229
# Not sure if awscli is needed for running lambda, but keeping it here for now
3330
RUN curl https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip -o awscliv2.zip \
34-
&& unzip awscliv2.zip \
35-
&& ./aws/install \
36-
&& rm -rf aws awscliv2.zip
31+
&& unzip awscliv2.zip \
32+
&& ./aws/install \
33+
&& rm -rf aws awscliv2.zip
3734

3835
COPY --from=builder \
3936
/usr/local/bin/aws-iam-authenticator \

Makefile

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

5-
LDFLAGS := -ldflags='-X "main.VersionRef=$(VERSION_REF)"'
5+
LDFLAGS := -ldflags='-s -w -X "main.VersionRef=$(VERSION_REF)"'
6+
export GOFLAGS := -trimpath
67

78
GOFILES = $(shell find . -iname '*.go' | grep -v -e vendor -e _modules -e _cache -e /data/)
89
TEST_KUBECONFIG = .kube/kind-kubeapply-test.yaml
@@ -12,7 +13,7 @@ LAMBDAZIP := kubeapply-lambda-$(VERSION_REF).zip
1213
# Main targets
1314
.PHONY: kubeapply
1415
kubeapply: data
15-
go build -o build/kubeapply $(LDFLAGS) ./cmd/kubeapply
16+
go build $(LDFLAGS) -o build/kubeapply ./cmd/kubeapply
1617

1718
.PHONY: install
1819
install: data
@@ -21,19 +22,19 @@ install: data
2122
# Lambda and server-related targets
2223
.PHONY: kubeapply-lambda
2324
kubeapply-lambda: data
24-
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -tags lambda.norpc -o build/kubeapply-lambda $(LDFLAGS) ./cmd/kubeapply-lambda
25+
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build $(LDFLAGS) -tags lambda.norpc -o build/kubeapply-lambda ./cmd/kubeapply-lambda
2526

2627
.PHONY: kubeapply-lambda-kubeapply
2728
kubeapply-lambda-kubeapply: data
28-
GOOS=linux GOARCH=amd64 go build -o build/kubeapply $(LDFLAGS) ./cmd/kubeapply
29+
GOOS=linux GOARCH=amd64 go build $(LDFLAGS) -o build/kubeapply ./cmd/kubeapply
2930

3031
.PHONY: lambda-zip
3132
lambda-zip: clean kubeapply-lambda kubeapply-lambda-kubeapply
3233
$Q./scripts/create-lambda-bundle.sh $(LAMBDAZIP)
3334

3435
.PHONY: kubeapply-server
3536
kubeapply-server: data
36-
go build -o build/kubeapply-server $(LDFLAGS) ./cmd/kubeapply-server
37+
go build $(LDFLAGS) -o build/kubeapply-server ./cmd/kubeapply-server
3738

3839
# Test and formatting targets
3940
.PHONY: test
@@ -72,12 +73,9 @@ $(TEST_KUBECONFIG):
7273
.PHONY: go-bindata
7374
go-bindata:
7475
ifeq (, $(shell which go-bindata))
75-
GO111MODULE=off go get -u github.com/kevinburke/go-bindata/...
76+
go install github.com/kevinburke/go-bindata/v4/...@latest
7677
endif
7778

7879
.PHONY: clean
7980
clean:
8081
rm -Rf *.zip .kube build vendor
81-
82-
publish:
83-
./scripts/publish.sh

0 commit comments

Comments
 (0)