forked from Kong/kubernetes-ingress-controller
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
31 lines (25 loc) · 987 Bytes
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
FROM golang:1.15 AS build
WORKDIR /kong-ingress-controller
COPY go.mod ./
COPY go.sum ./
RUN go mod download
ADD . .
ARG TAG
ARG REPO_INFO
ARG COMMIT
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o kong-ingress-controller -ldflags "-s -w -X main.RELEASE=$TAG -X main.COMMIT=$COMMIT -X main.REPO=$REPO_INFO" ./cli/ingress-controller
# Final stage: the running container.
FROM alpine:3.11
RUN apk --no-cache add ca-certificates
# Create the user (ID 1000) and group that will be used in the
# running container to run the process as an unprivileged user.
RUN addgroup -S kic && \
adduser -S kic -G kic -u 1000
# Import the compiled executable from the second stage.
COPY --from=build /kong-ingress-controller/kong-ingress-controller /bin
# Only for backwards compatibility
COPY --from=build /kong-ingress-controller/kong-ingress-controller .
# Perform any further action as an unprivileged user.
USER 1000
# Run the compiled binary.
ENTRYPOINT ["/kong-ingress-controller"]