Skip to content
Snippets Groups Projects
Verified Commit fe90821f authored by cyrinux's avatar cyrinux :construction_worker_tone1:
Browse files

fix: static build

parent 2b0136ce
No related branches found
Tags 1.24.0+tedomum.8
No related merge requests found
Pipeline #33244 passed
FROM golang:1.22
FROM golang:1.22 as builder
ARG VERSION="dev"
WORKDIR /usr/src/app
ENV CGO_ENABLED=0
ENV GO111MODULE=on
COPY go.mod go.sum ./
RUN go mod download && go mod verify
COPY . .
RUN make build \
&& mv bin/manager /manager_amd64 \
&& ln -s /manager_amd64 /manager
ENTRYPOINT ["/manager"]
&& mv bin/manager /manager_amd64
FROM alpine:latest
ARG VERSION="dev"
ENV SUMMARY="CloudNativePG Operator Container Image." \
DESCRIPTION="This Docker image contains CloudNativePG Operator."
LABEL summary="$SUMMARY" \
description="$DESCRIPTION" \
io.k8s.display-name="$SUMMARY" \
io.k8s.description="$DESCRIPTION" \
name="CloudNativePG Operator" \
vendor="CloudNativePG Contributors" \
url="https://cloudnative-pg.io/" \
version="$VERSION" \
release="1"
WORKDIR /
RUN apk --no-cache add ca-certificates tzdata
COPY licenses /licenses
COPY LICENSE /licenses
COPY --from=builder /manager_amd64 /bin/
RUN ln -sf /bin/manager_amd64 manager
USER 65532:65532
ENTRYPOINT [ "/manager" ]
......@@ -32,7 +32,7 @@ COMMIT := $(shell git rev-parse --short HEAD || echo unknown)
DATE := $(shell git log -1 --pretty=format:'%ad' --date short)
VERSION := $(shell git describe --tags --match 'v*' | sed -e 's/^v//; s/-g[0-9a-f]\+$$//; s/-\([0-9]\+\)$$/-dev\1/')
REPLACE_VERSION := $(shell git describe --tags --abbrev=0 $(shell git describe --tags --match 'v*' --abbrev=0)^)
LDFLAGS= "-X github.com/cloudnative-pg/cloudnative-pg/pkg/versions.buildVersion=${VERSION} $\
LDFLAGS= "-s -w -X github.com/cloudnative-pg/cloudnative-pg/pkg/versions.buildVersion=${VERSION} $\
-X github.com/cloudnative-pg/cloudnative-pg/pkg/versions.buildCommit=${COMMIT} $\
-X github.com/cloudnative-pg/cloudnative-pg/pkg/versions.buildDate=${DATE}"
DIST_PATH := $(shell pwd)/dist
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment