Skip to content

Commit

Permalink
Reduce image layer and strip debug flags
Browse files Browse the repository at this point in the history
(cherry picked from commit 941c7c8)
  • Loading branch information
Claes Mogren authored and mogren committed Nov 4, 2019
1 parent f3da448 commit fe5e552
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ endif

# Default to build the Linux binary
build-linux:
GOOS=linux GOARCH=$(ARCH) CGO_ENABLED=0 go build -o aws-k8s-agent -ldflags "$(LDFLAGS)"
GOOS=linux GOARCH=$(ARCH) CGO_ENABLED=0 go build -o aws-cni -ldflags "$(LDFLAGS)" ./plugins/routed-eni/
GOOS=linux GOARCH=$(ARCH) CGO_ENABLED=0 go build -o grpc_health_probe -ldflags "$(LDFLAGS)" ./client/health-check/
GOOS=linux GOARCH=$(ARCH) CGO_ENABLED=0 go build -o aws-k8s-agent -ldflags "-s -w $(LDFLAGS)"
GOOS=linux GOARCH=$(ARCH) CGO_ENABLED=0 go build -o aws-cni -ldflags " -s -w $(LDFLAGS)" ./plugins/routed-eni/
GOOS=linux GOARCH=$(ARCH) CGO_ENABLED=0 go build -o grpc_health_probe -ldflags "-s -w $(LDFLAGS)" ./client/health-check/

# Download portmap plugin
download-portmap:
Expand Down Expand Up @@ -73,7 +73,7 @@ docker-unit-test: build-docker-test

# Build metrics
build-metrics:
GOOS=linux GOARCH=$(ARCH) CGO_ENABLED=0 go build -o cni-metrics-helper/cni-metrics-helper cni-metrics-helper/cni-metrics-helper.go
GOOS=linux GOARCH=$(ARCH) CGO_ENABLED=0 go build -ldflags="-s -w" -o cni-metrics-helper/cni-metrics-helper cni-metrics-helper/cni-metrics-helper.go

# Build metrics Docker image
docker-metrics:
Expand Down
17 changes: 8 additions & 9 deletions scripts/dockerfiles/Dockerfile.release
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,18 @@ RUN make build-linux && make download-portmap

FROM amazonlinux:2
RUN yum update -y && \
yum install -y iproute && \
yum install -y iptables && \
yum install -y iproute && \
yum clean all

WORKDIR /app

COPY --from=builder /go/src/github.com/aws/amazon-vpc-cni-k8s/aws-cni /app
COPY --from=builder /go/src/github.com/aws/amazon-vpc-cni-k8s/misc/10-aws.conflist /app

COPY --from=builder /go/src/github.com/aws/amazon-vpc-cni-k8s/portmap /app
COPY --from=builder /go/src/github.com/aws/amazon-vpc-cni-k8s/aws-cni \
/go/src/github.com/aws/amazon-vpc-cni-k8s/misc/10-aws.conflist \
/go/src/github.com/aws/amazon-vpc-cni-k8s/portmap \
/go/src/github.com/aws/amazon-vpc-cni-k8s/aws-k8s-agent \
/go/src/github.com/aws/amazon-vpc-cni-k8s/grpc_health_probe \
/go/src/github.com/aws/amazon-vpc-cni-k8s/scripts/aws-cni-support.sh \
/go/src/github.com/aws/amazon-vpc-cni-k8s/scripts/install-aws.sh /app/

COPY --from=builder /go/src/github.com/aws/amazon-vpc-cni-k8s/aws-k8s-agent /app
COPY --from=builder /go/src/github.com/aws/amazon-vpc-cni-k8s/grpc_health_probe /app
COPY --from=builder /go/src/github.com/aws/amazon-vpc-cni-k8s/scripts/aws-cni-support.sh /app
COPY --from=builder /go/src/github.com/aws/amazon-vpc-cni-k8s/scripts/install-aws.sh /app
ENTRYPOINT /app/install-aws.sh

0 comments on commit fe5e552

Please sign in to comment.