forked from IBM/mr-cassop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
37 lines (26 loc) · 881 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
31
32
33
34
35
36
37
ARG DOCKER_PROXY_REGISTRY=""
FROM ${DOCKER_PROXY_REGISTRY}golang:1.18 as builder
WORKDIR /workspace
COPY go.mod go.mod
COPY go.sum go.sum
RUN go mod download
COPY main.go main.go
COPY api/ api/
COPY controllers/ controllers/
ARG VERSION=undefined
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on \
go build \
-ldflags "-X main.Version=$VERSION" \
-a \
-o bin/cassandra-operator main.go
ARG DOCKER_PROXY_REGISTRY=""
FROM ${DOCKER_PROXY_REGISTRY}debian:bookworm-slim
WORKDIR /
RUN apt-get update && \
apt-get install -y ca-certificates && \
update-ca-certificates && \
rm -rf /var/lib/apt/lists/*
RUN addgroup --gid 901 cassandra-operator && adduser --uid 901 --gid 901 --home /home/cassandra-operator cassandra-operator
COPY --from=builder /workspace/bin/cassandra-operator .
USER cassandra-operator
ENTRYPOINT ["/cassandra-operator"]