forked from pravega/zookeeper-operator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
29 lines (19 loc) · 812 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
FROM golang:1.13.4-alpine3.10 as go-builder
ARG PROJECT_NAME=zookeeper-operator
# Build version and commit should be passed in when performing docker build
ARG VERSION=0.0.0-localdev
ARG GIT_SHA=0000000
WORKDIR /src
COPY pkg ./pkg
COPY cmd ./cmd
COPY go.mod* /src
RUN ls /src/ && GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o /src/${PROJECT_NAME} \
-ldflags "-X ${REPO_PATH}/pkg/version.Version=${VERSION} -X ${REPO_PATH}/pkg/version.GitSHA=${GIT_SHA}" \
/src/cmd/manager
# =============================================================================
FROM alpine:3.10 AS final
ARG PROJECT_NAME=zookeeper-operator
COPY --from=go-builder /src/${PROJECT_NAME} /usr/local/bin/${PROJECT_NAME}
RUN adduser -D ${PROJECT_NAME}
USER ${PROJECT_NAME}
ENTRYPOINT ["/usr/local/bin/zookeeper-operator"]