From 763905f1f5df744574cb005a139a632793d6e81e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=BC=D0=B8=D1=82=D1=80=D0=B8=D0=B9=20=D0=A1=D0=B0?= =?UTF-8?q?=D1=84=D1=80=D0=BE=D0=BD=D0=BE=D0=B2?= <zimniy@cyberbrain.pw> Date: Sat, 26 Jun 2021 18:09:58 +0000 Subject: [PATCH] Resolve "Customizable Ansible version" --- Dockerfile | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 331d232..e4d3c2c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,5 @@ FROM registry.cyberbrain.pw/docker/alpine:latest AS builder +ARG ANSIBLE_VERSION ENV PATH="/opt/ansible/bin:$PATH" RUN apk --no-cache add python3 && \ apk --no-cache add --virtual build-dependencies \ @@ -14,8 +15,11 @@ RUN apk --no-cache add python3 && \ setuptools \ wheel \ && \ + ( test -z $ANSIBLE_VERSION && \ + pip install --ignore-installed --no-cache-dir ansible || \ + pip install --ignore-installed --no-cache-dir ansible\<=$ANSIBLE_VERSION \ + ) && \ pip3 install --ignore-installed --no-cache-dir \ - ansible \ ansible-lint \ mitogen \ jmespath \ @@ -35,6 +39,8 @@ RUN apk --no-cache add \ sshpass \ openssh-client \ rsync \ - git + git \ + && \ + rm -rf /var/cache/apk/* COPY --from=builder /opt/ansible /opt/ansible CMD [ "ansible", "--version" ] -- GitLab