Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OCPVE-316: Reduce number of Dockerfiles and simplify Makefile #328

Merged
merged 1 commit into from
Apr 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 20 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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