Skip to content

Dockerfile improvements #1125

@ddjain

Description

@ddjain

Suggestion:

  • Kubevirt, oc : Instead of building from source inside container, can we install binary? so we will be pin to perticular version of kubevirt, oc to avoid breaking changes.

    # virtctl build
    WORKDIR /tmp
    RUN git clone https://github.com/kubevirt/kubevirt.git
    WORKDIR /tmp/kubevirt
    RUN go mod edit -go 1.24.9 &&\
        go work use &&\
        go build -o virtctl ./cmd/virtctl/
  • [Size Optimization] Can we use multistage docker image for python, instead of installing python manually, can we use python3.9-slim image? this will reduce the size of image

    RUN rm -rf "$(pip cache dir)"
    RUN rm -rf /tmp/*
    RUN rm -rf /usr/local/lib/python3.9/ensurepip/_bundled
    RUN pip3.9 install -r requirements.txt
    RUN pip3.9 install jsonschema
  • [minor] Remove Duplicate layers in dockerfile. we are doing dnf update twice, we can remove one of them

    RUN dnf update -y
    
    ENV KUBECONFIG /home/krkn/.kube/config
    
    
    # This overwrites any existing configuration in /etc/yum.repos.d/kubernetes.repo
    RUN dnf update && dnf install -y --setopt=install_weak_deps=False \
        git python39 jq yq gettext wget which ipmitool openssh-server &&\
        dnf clean all

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions