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

Reduce Container Size #52

Merged
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
26 changes: 16 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
# Build the manager binary
FROM quay.io/centos/centos:stream8 AS builder
RUN dnf install -y dnf-plugins-core \
&& dnf config-manager --set-enabled ha
RUN dnf install -y golang git

RUN dnf install -y golang git \
&& dnf clean all -y

# Ensure correct Go version
ENV GO_VERSION=1.18
RUN go install golang.org/dl/go${GO_VERSION}@latest
RUN ~/go/bin/go${GO_VERSION} download
RUN /bin/cp -f ~/go/bin/go${GO_VERSION} /usr/bin/go
RUN go version
RUN go install golang.org/dl/go${GO_VERSION}@latest \
&& ~/go/bin/go${GO_VERSION} download \
&& /bin/cp -f ~/go/bin/go${GO_VERSION} /usr/bin/go \
&& go version

WORKDIR /
WORKDIR /workspace
# Copy the Go Modules manifests
COPY go.mod go.mod
COPY go.sum go.sum
Expand All @@ -32,8 +30,16 @@ COPY .git/ .git/
# Build
RUN ./hack/build.sh

FROM quay.io/centos/centos:stream8

WORKDIR /
COPY --from=builder /workspace/manager .

# Add Fence Agents and fence-agents-aws packages
RUN dnf install -y fence-agents-all fence-agents-aws
RUN dnf install -y dnf-plugins-core \
&& dnf config-manager --set-enabled ha \
&& dnf install -y fence-agents-all fence-agents-aws \
&& dnf clean all -y

USER 65532:65532
ENTRYPOINT ["/manager"]