opiproject / ansible-opi-dpu

Ansible Modules for DPUs
Apache License 2.0
6 stars 8 forks source link

docker: use requirements file instead #10

Closed glimchb closed 8 months ago

glimchb commented 8 months ago

COPY requirements and pip install the file

here https://github.com/opiproject/ansible-opi-dpu/blob/main/Dockerfile

for example:

diff --git a/Dockerfile b/Dockerfile
index c14e3b6..1a58787 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,7 +1,9 @@
 FROM python:3.11
 ARG ANSIBLE_VERSION=stable-2.16
 RUN pip install --no-cache-dir --disable-pip-version-check https://github.com/ansible/ansible/archive/${ANSIBLE_VERSION}.tar.gz
+COPY ./requirements.txt /tmp/requirements.txt
+RUN pip install --no-cache-dir --disable-pip-version-check --requirement /tmp/requirements.txt
 COPY ./requirements.yml /tmp/requirements.yml

run example like this:

 $ docker run --rm -it --entrypoint ansible-playbook -v $(pwd):$(pwd) -w $(pwd)/roles ghcr.io/opiproject/ansible-opi-dpu:main ../playbooks/firmware.yml -vvv -i "10.10.10.1," -e dpu_bmc_username='root' -e dpu_bmc_password='123456'

document this on readme...