Skip to content
Open
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
18 changes: 9 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ FROM quay.io/centos/centos:stream9 as builder
WORKDIR /workspace

# Install necessary tools and dependencies in a single RUN command to minimize image layers
RUN yum -y install epel-release && \
yum config-manager --set-enabled crb && \
yum -y install gcc glibc-devel glibc-headers libvirt-devel go && \
yum clean all
RUN dnf -y install epel-release && \
dnf config-manager --set-enabled crb && \
dnf -y install gcc glibc-devel glibc-headers libvirt-devel go && \
dnf clean all

# Copy the Go Modules manifests
COPY go.mod go.mod
Expand All @@ -30,20 +30,20 @@ RUN CGO_ENABLED=1 go build -a -o ofcir-operator main.go
RUN CGO_ENABLED=0 go build -a -o ofcir-api cmd/ofcir-api/main.go

# Cleanup
RUN yum remove -y gcc glibc-devel glibc-headers libvirt-devel go && \
yum clean all && \
RUN dnf remove -y gcc glibc-devel glibc-headers libvirt-devel go && \
dnf clean all && \
rm -rf /var/cache/yum

# Final stage - create the runtime image
FROM quay.io/centos/centos:stream9 as runtime

WORKDIR /

RUN yum -y install libvirt-libs && \
yum clean all
RUN dnf -y install libvirt-libs && \
dnf clean all

# Copy the binaries from the builder stage
COPY --from=builder /workspace/ofcir-operator .
COPY --from=builder /workspace/ofcir-api .

ENTRYPOINT ["/ofcir-api"]
ENTRYPOINT ["/ofcir-api"]