Skip to content

Commit bdff33e

Browse files
committed
update build info to push to docker.io/sysdig/kube-psp-advisor
Signed-off-by: kaizhe <[email protected]>
1 parent 81c60d4 commit bdff33e

File tree

4 files changed

+21
-12
lines changed

4 files changed

+21
-12
lines changed

Makefile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
.PHONY: all
22

33
all: build test
4+
IMG="sysdig/kube-psp-advisor"
5+
VERSION=$(shell cat version)
46

57
test:
68
@echo "+ $@"
@@ -11,3 +13,11 @@ example:
1113
build:
1214
@echo "+ $@"
1315
./scripts/build
16+
build-image:
17+
@echo "+ $@"
18+
docker build -f container/Dockerfile -t ${IMG}:${VERSION} .
19+
push-image:
20+
@echo "+ $@"
21+
docker push ${IMG}:${VERSION}
22+
docker tag ${IMG}:${VERSION} ${IMG}:latest
23+
docker push ${IMG}:latest

container/Dockerfile

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
1-
FROM golang:1.12.9-alpine3.10
2-
RUN apk add --no-cache git curl
1+
FROM golang:1.12.9-alpine3.10 AS builder
2+
RUN apk add --no-cache build-base git
33
WORKDIR $GOPATH/src/kube-psp-advisor
4-
COPY . .
5-
# aws-iam-authenticator is optional, please install necessary k8s cloud authenticator accordingly
6-
# RUN curl -o aws-iam-authenticator https://amazon-eks.s3-us-west-2.amazonaws.com/1.11.5/2018-12-06/bin/linux/amd64/aws-iam-authenticator
7-
# RUN chmod u+x aws-iam-authenticator
8-
# RUN mv aws-iam-authenticator /usr/local/bin
4+
COPY . $GOPATH/src/kube-psp-advisor
95
ENV GO111MODULE=on
10-
RUN go get -d -v ./...
11-
RUN env GOOS=$(uname -s | tr '[:upper:]' '[:lower:]') GOARCH=amd64 CGO_ENABLED=0 go build -a
12-
ENV PATH /go/src/kube-psp-advisor:$PATH
13-
RUN apk del curl
6+
RUN go get golang.org/x/tools/cmd/goimports
7+
RUN make build
8+
9+
FROM alpine
10+
RUN apk update && apk add ca-certificates && rm -rf /var/cache/apk/*
11+
COPY --from=builder /go/src/kube-psp-advisor/kube-psp-advisor /kube-psp-advisor
1412

1513
ENTRYPOINT ["kube-psp-advisor"]
1614
CMD ["inspect"]

scripts/build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
set -eux
44

55
export GO111MODULE=on
6-
#dep ensure
6+
77
$GOPATH/bin/goimports -w $(find . -type f -name '*.go' -not -path "./vendor/*") || true
88

99
env GOOS=$(uname -s | tr '[:upper:]' '[:lower:]') GOARCH=amd64 go build -a

version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1.1.0

0 commit comments

Comments
 (0)