This repository has been archived by the owner on Aug 26, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace ansible-builder with plan container building
- Loading branch information
Showing
3 changed files
with
35 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,24 @@ | ||
ARG EE_BASE_IMAGE=quay.io/ansible/ansible-runner:latest | ||
ARG EE_BUILDER_IMAGE=quay.io/ansible/ansible-builder:latest | ||
|
||
FROM $EE_BASE_IMAGE as galaxy | ||
ARG ANSIBLE_GALAXY_CLI_COLLECTION_OPTS= | ||
USER root | ||
|
||
ADD _build /build | ||
WORKDIR /build | ||
|
||
RUN ansible-galaxy role install -r requirements.yml --roles-path "/usr/share/ansible/roles" | ||
RUN ANSIBLE_GALAXY_DISABLE_GPG_VERIFY=1 ansible-galaxy collection install $ANSIBLE_GALAXY_CLI_COLLECTION_OPTS -r requirements.yml --collections-path "/usr/share/ansible/collections" | ||
|
||
FROM $EE_BUILDER_IMAGE as builder | ||
|
||
COPY --from=galaxy /usr/share/ansible /usr/share/ansible | ||
|
||
ADD _build/requirements.txt requirements.txt | ||
ADD _build/bindep.txt bindep.txt | ||
RUN ansible-builder introspect --sanitize --user-pip=requirements.txt --user-bindep=bindep.txt --write-bindep=/tmp/src/bindep.txt --write-pip=/tmp/src/requirements.txt | ||
RUN assemble | ||
|
||
# Overly simplified single stage build process: we take all binary dependencies | ||
# using dnf and use pip to install the rest. | ||
ARG EE_BASE_IMAGE=quay.io/fedora/fedora:latest | ||
FROM $EE_BASE_IMAGE | ||
USER root | ||
|
||
COPY --from=galaxy /usr/share/ansible /usr/share/ansible | ||
|
||
COPY --from=builder /output/ /output/ | ||
RUN /output/install-from-bindep && rm -rf /output/wheels | ||
RUN set -ex && /output/install-from-bindep && rm -rf /output/wheels && alternatives --set python /usr/bin/python3 && dnf -y upgrade && dnf autoremove | ||
COPY _build/requirements.in /root/requirements.in | ||
COPY _build/requirements.txt /root/requirements.txt | ||
RUN \ | ||
dnf update -y && \ | ||
dnf -y upgrade && \ | ||
dnf install -y podman python3-pip git python3-cffi python3-cryptography python3-ruamel-yaml python3-pyyaml python3-pyrsistent && \ | ||
dnf autoremove | ||
RUN \ | ||
pip3 install -r /root/requirements.in -c /root/requirements.txt && \ | ||
rm -rf $(pip3 cache dir) | ||
# add some helpful CLI commands to check we do not remove them inadvertently and output some helpful version information at build time. | ||
RUN set -ex \ | ||
&& molecule --version \ | ||
&& molecule drivers \ | ||
&& ansible-lint --version \ | ||
&& podman --version \ | ||
&& python --version \ | ||
&& git --version | ||
&& ansible-lint --version \ | ||
&& molecule --version \ | ||
&& molecule drivers \ | ||
&& podman --version \ | ||
&& python3 --version \ | ||
&& git --version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters