Skip to content

Commit

Permalink
Merge pull request #328 from suleymanakbas91/reduce-dockerfiles
Browse files Browse the repository at this point in the history
OCPVE-316: Reduce number of Dockerfiles and simplify Makefile
suleymanakbas91 authored Apr 25, 2023
2 parents d7199e6 + 6122998 commit 7cacafc
Showing 10 changed files with 176 additions and 263 deletions.
23 changes: 20 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -13,15 +13,32 @@ RUN go mod download
COPY main.go main.go
COPY api/ api/
COPY controllers/ controllers/
COPY cmd/ cmd/
COPY pkg/ pkg/

# Build
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build --ldflags "-s -w" -a -o manager main.go
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build --ldflags "-s -w" -a -o vgmanager cmd/vgmanager/main.go
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build --ldflags "-s -w" -a -o metricsexporter cmd/metricsexporter/exporter.go

# vgmanager needs 'nsenter' and other basic linux utils to correctly function
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.7

# Update the image to get the latest CVE updates
RUN microdnf update -y && \
microdnf install -y openssl && \
microdnf install -y util-linux && \
microdnf clean all

# Use distroless as minimal base image to package the manager binary
# Refer to https://github.com/GoogleContainerTools/distroless for more details
FROM gcr.io/distroless/static:nonroot
WORKDIR /
COPY --from=builder /workspace/manager .
COPY --from=builder /workspace/vgmanager .
COPY --from=builder /workspace/metricsexporter .
EXPOSE 23532
USER 65532:65532

# '/manager' is lvm-operator entrypoint
ENTRYPOINT ["/manager"]

# '/vgmanager' is vgmanager entrypoint which is used in daemonset image
# ENTRYPOINT ["/vgmanager"]
44 changes: 0 additions & 44 deletions Dockerfile.combined

This file was deleted.

34 changes: 0 additions & 34 deletions Dockerfile.vgmanager

This file was deleted.

Loading

0 comments on commit 7cacafc

Please sign in to comment.