diff --git a/Containerfile b/Containerfile index a0d6f17..afcda61 100644 --- a/Containerfile +++ b/Containerfile @@ -1,9 +1,25 @@ -FROM quay.io/fedora/fedora-minimal:44 AS buildroot -ARG DNF_FLAGS="-y --setopt=install_weak_deps=False" +ARG GO_BUILDER_IMAGE=quay.io/hummingbird/go:1.26.8-builder +ARG CORE_RUNTIME_IMAGE=quay.io/hummingbird/core-runtime:2.43 + + +FROM ${GO_BUILDER_IMAGE} AS deps +# We pull required dependencies and overlay them +# on top of the runtime image +ARG DNF_FLAGS="-y --setopt=install_weak_deps=False --nodocs" RUN --mount=type=cache,id=dnf,target=/var/cache/libdnf5 \ - dnf install ${DNF_FLAGS} golang + mkdir -p /staged &&\ + dnf install -y \ + --use-host-config \ + --installroot=/staged \ + util-linux-core && \ + # Remove metadata and manpages + rm -rf /staged/var/lib/dnf \ + /staged/var/log/* \ + /staged/var/lib/rpm \ + /staged/usr/share/{man,doc,locale} + +FROM ${GO_BUILDER_IMAGE} AS builder -FROM buildroot as builder ARG VERSION=dev ARG GIT_COMMIT=unknown WORKDIR /workspace @@ -17,7 +33,8 @@ RUN --mount=type=cache,id=gomod,target=/root/go/pkg/mod \ go build -ldflags "${LDFLAGS}" -o manager ./cmd/controller/ && \ go build -ldflags "${LDFLAGS}" -o daemon ./cmd/daemon/ -FROM quay.io/fedora/fedora-minimal:44 +FROM ${CORE_RUNTIME_IMAGE} +COPY --from=deps /staged/usr /usr COPY --from=builder /workspace/manager /workspace/daemon /usr/local/bin/ USER 65532:65532 ENTRYPOINT ["manager"]