diff --git a/Dockerfile b/Dockerfile index 331d2322ff40ce784f915d4d0f5c21518b32477e..da9acd99367c0c350c5f58703e5c4f2c404482ac 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 pyyaml ansible || \ + pip install --ignore-installed --no-cache-dir pyyaml 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" ]