Skip to content

Commit

Permalink
chore: reduce number of Dockerfiles
Browse files Browse the repository at this point in the history
Signed-off-by: Suleyman Akbas <[email protected]>
  • Loading branch information
suleymanakbas91 committed Apr 25, 2023
1 parent d7199e6 commit 6122998
Show file tree
Hide file tree
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
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

0 comments on commit 6122998

Please sign in to comment.