ansible / ansible-builder

An Ansible execution environment builder
Other
287 stars 93 forks source link

v3 prepend_builder adds command after "pip install" #656

Closed luckyzor closed 5 months ago

luckyzor commented 6 months ago

Hello,

I'm learning ansible-builder and I came across an issue concerning the builder when it needs to install pip packages.

I've added a prepend_builder command to copy the pip.cfg to the correct path, but the command is after the pip install.

prepend_builder: |
        COPY _build/configs/pip.conf /etc/pip.conf

in the container file:

# Builder build stage
FROM base as builder
WORKDIR /build
ARG EE_BASE_IMAGE
ARG PYCMD
ARG PKGMGR_PRESERVE_CACHE
ARG ANSIBLE_GALAXY_CLI_COLLECTION_OPTS
ARG ANSIBLE_GALAXY_CLI_ROLE_OPTS
ARG PKGMGR

RUN $PYCMD -m pip install --no-cache-dir bindep pyyaml requirements-parser
COPY _build/configs/pip.conf /etc/pip.conf

COPY --from=galaxy /usr/share/ansible /usr/share/ansible

unfortunately, because of this pip can't install the packages ( I need a proxy to install pip packages )

Am I doing something wrong?

Thank you

Shrews commented 5 months ago

Duplicate of https://github.com/ansible/ansible-builder/issues/603

Use prepend_base to modify the base image, which will carry over to the builder image.