From 3e946500a96f8017e4a9e266c019dec30a667ee1 Mon Sep 17 00:00:00 2001
From: Dmitriy Safronov <zimniy@cyberbrain.pw>
Date: Sat, 26 Jun 2021 13:28:25 +0300
Subject: [PATCH] Dockerfile

---
 Dockerfile | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/Dockerfile b/Dockerfile
index a36fb93..ffe48d3 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -15,14 +15,17 @@ RUN apk --no-cache add python3 && \
         setuptools \
         wheel \
         && \
+    ( test -z $ANSIBLE_VERSION && \
+        pip install --ignore-installed --user --no-cache-dir ansible || \
+        pip install --ignore-installed --user --no-cache-dir ansible\<=$ANSIBLE_VERSION \
+        ) && \
     pip3 install --ignore-installed --no-cache-dir \
-        ansible \
         ansible-lint \
         mitogen \
         jmespath \
         pywinrm \
         && \
-    apk del build-dependencies && \
+    #apk del build-dependencies && \
     rm -rf /var/cache/apk/*
 
 FROM registry.cyberbrain.pw/docker/alpine:latest AS runtime
@@ -35,6 +38,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