-
Notifications
You must be signed in to change notification settings - Fork 54
/
Dockerfile
29 lines (26 loc) · 1.07 KB
/
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 registry.access.redhat.com/ubi9/go-toolset:1.21 AS build
ARG OPERATOR_VERSION
ARG SKAFFOLD_GO_GCFLAGS
WORKDIR /workspace
USER root
# Copy the Go Modules manifests
COPY go.mod go.mod
COPY go.sum go.sum
# cache deps before building and copying source so that we don't need to re-download as much
# and so that source changes don't invalidate our downloaded layer
RUN go mod download
# Copy the go source
COPY main.go main.go
COPY api/ api/
COPY controllers/ controllers/
COPY launcher/ launcher/
COPY pkg/ pkg/
RUN CGO_ENABLED=1 GOOS=linux GO111MODULE=on \
go build -a -o /bin/infinispan-operator \
-ldflags="-X 'github.com/infinispan/infinispan-operator/launcher.Version=${OPERATOR_VERSION}'" -gcflags="${SKAFFOLD_GO_GCFLAGS}" main.go
FROM registry.access.redhat.com/ubi9/ubi-micro
COPY --from=build /bin/infinispan-operator /usr/local/bin/infinispan-operator
# Define GOTRACEBACK to mark this container as using the Go language runtime
# for `skaffold debug` (https://skaffold.dev/docs/workflows/debug/).
ENV GOTRACEBACK=single
ENTRYPOINT [ "/usr/local/bin/infinispan-operator" ]