Skip to content

UPSTREAM: <carry>: Switch to UBI for builder image #7

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

Merged
merged 1 commit into from
Apr 6, 2022
Merged
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
10 changes: 4 additions & 6 deletions Dockerfile.openshift
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# TODO: Switch to UBI golang image when 1.17 is released
# FROM registry.access.redhat.com/ubi8/go-toolset:latest AS builder
FROM golang:1.17 AS builder
FROM registry.access.redhat.com/ubi8/go-toolset:1.16.12 AS builder

WORKDIR /workspace
WORKDIR /opt/app-root/src

# Copy the dependencies which don't change frequently
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should reduce layers and just do a COPY . ., we can add a .dockerignore for other files.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would reduce the layer but increases the build time for the container because the layer changes every time one file in the entire directory changes. Then go has to download all the dependencies, and rebuild everything again.

COPY go.mod go.mod
Expand All @@ -17,8 +15,8 @@ COPY pkg pkg
COPY webhooks webhooks

# Build the controller
RUN go build -mod=vendor -o bin/controller main.go
RUN go build -mod=vendor -o controller main.go

FROM registry.access.redhat.com/ubi8/ubi-minimal:latest
COPY --from=builder /workspace/bin/controller /usr/bin/controller
COPY --from=builder /opt/app-root/src/controller /usr/bin/controller
ENTRYPOINT ["/usr/bin/controller"]