mirror of
https://github.com/1Password/onepassword-operator.git
synced 2025-10-22 07:28:06 +00:00
Add optional $operator_version Dockerfile arg.
Value is passed to `go build` process and dynamically updates the version.Version variable.
This commit is contained in:
10
Dockerfile
10
Dockerfile
@@ -12,7 +12,15 @@ COPY pkg/ pkg/
|
|||||||
COPY version/ version/
|
COPY version/ version/
|
||||||
COPY vendor/ vendor/
|
COPY vendor/ vendor/
|
||||||
# Build
|
# Build
|
||||||
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -mod vendor -a -o manager main.go
|
ARG operator_version=dev
|
||||||
|
RUN CGO_ENABLED=0 \
|
||||||
|
GOOS=linux \
|
||||||
|
GOARCH=amd64 \
|
||||||
|
GO111MODULE=on \
|
||||||
|
go build \
|
||||||
|
-ldflags "-X version.Version=$operator_version" \
|
||||||
|
-mod vendor \
|
||||||
|
-a -o manager main.go
|
||||||
|
|
||||||
# Use distroless as minimal base image to package the manager binary
|
# Use distroless as minimal base image to package the manager binary
|
||||||
# Refer to https://github.com/GoogleContainerTools/distroless for more details
|
# Refer to https://github.com/GoogleContainerTools/distroless for more details
|
||||||
|
Reference in New Issue
Block a user