Skip to content

Commit

Permalink
Switch to use go module, fmt, docker changes, go 1.14 (#5)
Browse files Browse the repository at this point in the history
* run gofmt

* Switch to use go module, fmt, docker changes
  • Loading branch information
max-rocket-internet authored Apr 28, 2020
1 parent 49ad175 commit 4a8326c
Show file tree
Hide file tree
Showing 5 changed files with 290 additions and 72 deletions.
4 changes: 4 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*
!main.go
!go.mod
!go.sum
18 changes: 9 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
FROM golang:1.12.1
WORKDIR /go/src/github.com/deliveryhero/k8s-event-logger
COPY main.go .
RUN go get -d -v ./...
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o main .
FROM golang:1.14.0 as builder
WORKDIR /go/src/github.com/max-rocket-internet/k8s-event-logger
COPY . .
RUN go get
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o k8s-event-logger
RUN adduser --disabled-login --no-create-home --disabled-password --system --uid 101 non-root

FROM alpine:3.9.3
RUN apk --no-cache add ca-certificates
WORKDIR /
COPY --from=0 /go/src/github.com/deliveryhero/k8s-event-logger/main k8s-event-logger
USER 101
RUN addgroup -S non-root && adduser -S -G non-root non-root
USER non-root
ENV USER non-root
COPY --from=builder /go/src/github.com/max-rocket-internet/k8s-event-logger/k8s-event-logger k8s-event-logger
CMD ["/k8s-event-logger"]
13 changes: 13 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module github.com/max-rocket-internet/k8s-event-logger

go 1.14

require (
github.com/imdario/mergo v0.3.9 // indirect
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d // indirect
golang.org/x/time v0.0.0-20200416051211-89c76fbcd5d1 // indirect
k8s.io/api v0.18.2
k8s.io/apimachinery v0.18.2
k8s.io/client-go v0.18.2
k8s.io/utils v0.0.0-20200414100711-2df71ebbae66 // indirect
)
Loading

0 comments on commit 4a8326c

Please sign in to comment.