From f29052832a9d87d49ec00523636b330eb5000915 Mon Sep 17 00:00:00 2001 From: Dmitriy Safronov Date: Tue, 18 May 2021 17:39:06 +0300 Subject: [PATCH 01/13] new --- Dockerfile | 35 +++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 8230fc3..e628ac1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,32 @@ -FROM pipelinecomponents/ansible-lint:latest - +FROM registry.cyberbrain.pw/docker/alpine:latest +RUN apk --no-cache add \ + sudo \ + python3 \ + py3-pip \ + openssl \ + ca-certificates \ + sshpass \ + openssh-client \ + rsync \ + git && \ + apk --no-cache add --virtual build-dependencies \ + python3-dev \ + libffi-dev \ + openssl-dev \ + build-base && \ + pip3 install --upgrade \ + pip \ + cffi \ + wheel && \ + pip3 install \ + cryptography \ + ansible \ + mitogen ansible-lint jmespath \ + pywinrm && \ + apk del build-dependencies && \ + rm -rf /var/cache/apk/* +RUN mkdir -p /opt/ansible && \ + mkdir -p /etc/ansible && \ + echo 'localhost' > /etc/ansible/hosts WORKDIR /opt/ansible - -RUN apk add --no-cache git git-lfs openssh-client rsync +CMD [ "ansible", "--version" ] -- GitLab From cd0308b5c91ad3a5a138af6e6d5c02a44ae803ad Mon Sep 17 00:00:00 2001 From: Dmitriy Safronov Date: Tue, 18 May 2021 17:40:28 +0300 Subject: [PATCH 02/13] new --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index e628ac1..30a5320 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,11 +14,11 @@ RUN apk --no-cache add \ libffi-dev \ openssl-dev \ build-base && \ - pip3 install --upgrade \ + pip3 install --no-cache-dir --upgrade \ pip \ cffi \ wheel && \ - pip3 install \ + pip3 install --no-cache-dir \ cryptography \ ansible \ mitogen ansible-lint jmespath \ -- GitLab From b23d8bad650962acdd623f4c5bdc765ec5579afe Mon Sep 17 00:00:00 2001 From: Dmitriy Safronov Date: Tue, 18 May 2021 17:42:17 +0300 Subject: [PATCH 03/13] new --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 30a5320..d6cbcd6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -24,8 +24,8 @@ RUN apk --no-cache add \ mitogen ansible-lint jmespath \ pywinrm && \ apk del build-dependencies && \ - rm -rf /var/cache/apk/* -RUN mkdir -p /opt/ansible && \ + rm -rf /var/cache/apk/* && \ + mkdir -p /opt/ansible && \ mkdir -p /etc/ansible && \ echo 'localhost' > /etc/ansible/hosts WORKDIR /opt/ansible -- GitLab From c4f3c74c5fb47293b0a06bfc19b8f5f92398d79f Mon Sep 17 00:00:00 2001 From: Dmitriy Safronov Date: Tue, 18 May 2021 17:45:28 +0300 Subject: [PATCH 04/13] new --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index d6cbcd6..607e3ac 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,8 +19,8 @@ RUN apk --no-cache add \ cffi \ wheel && \ pip3 install --no-cache-dir \ - cryptography \ ansible \ + cryptography \ mitogen ansible-lint jmespath \ pywinrm && \ apk del build-dependencies && \ -- GitLab From e476b4b8542a10e6748388f715fe84569e1f6d6b Mon Sep 17 00:00:00 2001 From: Dmitriy Safronov Date: Tue, 18 May 2021 17:49:25 +0300 Subject: [PATCH 05/13] new --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index 607e3ac..aa48488 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,6 +13,7 @@ RUN apk --no-cache add \ python3-dev \ libffi-dev \ openssl-dev \ + rust \ build-base && \ pip3 install --no-cache-dir --upgrade \ pip \ -- GitLab From 655284edd2f56234fbfe1a96fceff24300f1afd0 Mon Sep 17 00:00:00 2001 From: Dmitriy Safronov Date: Tue, 18 May 2021 19:25:13 +0300 Subject: [PATCH 06/13] new --- Dockerfile | 56 ++++++++++++++++++++++++++++++++---------------------- 1 file changed, 33 insertions(+), 23 deletions(-) diff --git a/Dockerfile b/Dockerfile index aa48488..5a2681e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,33 +1,43 @@ -FROM registry.cyberbrain.pw/docker/alpine:latest -RUN apk --no-cache add \ - sudo \ - python3 \ - py3-pip \ - openssl \ - ca-certificates \ - sshpass \ - openssh-client \ - rsync \ - git && \ +FROM registry.cyberbrain.pw/docker/alpine:latest AS builder +ENV PATH="/opt/ansible/bin:$PATH" +RUN apk --no-cache add python3 && \ apk --no-cache add --virtual build-dependencies \ + py3-pip \ + musl-dev \ python3-dev \ libffi-dev \ openssl-dev \ - rust \ - build-base && \ - pip3 install --no-cache-dir --upgrade \ + cargo \ + && \ + python3 -m venv /opt/ansible && \ + pip3 install --ignore-installed --no-cache-dir --upgrade \ pip \ - cffi \ - wheel && \ - pip3 install --no-cache-dir \ + setuptools \ + wheel \ + && \ + pip3 install --ignore-installed --no-cache-dir \ ansible \ - cryptography \ - mitogen ansible-lint jmespath \ - pywinrm && \ + ansible-lint \ + mitogen \ + jmespath \ + pywinrm \ + && \ apk del build-dependencies && \ - rm -rf /var/cache/apk/* && \ - mkdir -p /opt/ansible && \ + rm -rf /var/cache/apk/* + +FROM registry.cyberbrain.pw/docker/alpine:latest AS runtime +ENV PATH="/opt/ansible/bin:$PATH" +WORKDIR /srv/ansible +RUN apk --no-cache add \ + python3 \ + openssl \ + ca-certificates \ + sshpass \ + openssh-client \ + rsync \ + git \ + && \ mkdir -p /etc/ansible && \ echo 'localhost' > /etc/ansible/hosts -WORKDIR /opt/ansible +COPY --from=builder /opt/ansible /opt/ansible CMD [ "ansible", "--version" ] -- GitLab From 40989024fc8b552def86cd23a121289331973c19 Mon Sep 17 00:00:00 2001 From: Dmitriy Safronov Date: Tue, 18 May 2021 19:55:30 +0300 Subject: [PATCH 07/13] new --- Dockerfile | 2 -- 1 file changed, 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 5a2681e..0ce8daf 100644 --- a/Dockerfile +++ b/Dockerfile @@ -37,7 +37,5 @@ RUN apk --no-cache add \ rsync \ git \ && \ - mkdir -p /etc/ansible && \ - echo 'localhost' > /etc/ansible/hosts COPY --from=builder /opt/ansible /opt/ansible CMD [ "ansible", "--version" ] -- GitLab From a43b2a61766546233396b75eb311ee519eab1804 Mon Sep 17 00:00:00 2001 From: Dmitriy Safronov Date: Tue, 18 May 2021 20:08:36 +0300 Subject: [PATCH 08/13] new --- .gitlab-ci.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5ff3713..71b9df5 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -22,6 +22,3 @@ test: GIT_STRATEGY: "none" script: - drr "${CI_REGISTRY_IMAGE}:${CUSTOM_IMAGEPREFIX}-${CI_COMMIT_SHORT_SHA}" ansible --version - - drr "${CI_REGISTRY_IMAGE}:${CUSTOM_IMAGEPREFIX}-${CI_COMMIT_SHORT_SHA}" ansible -m ping localhost - - drr "${CI_REGISTRY_IMAGE}:${CUSTOM_IMAGEPREFIX}-${CI_COMMIT_SHORT_SHA}" ansible-lint --version - - drr "${CI_REGISTRY_IMAGE}:${CUSTOM_IMAGEPREFIX}-${CI_COMMIT_SHORT_SHA}" ansible-lint . -- GitLab From c02ee3c77c71860c7237e21f37a4ae406c1b070b Mon Sep 17 00:00:00 2001 From: Dmitriy Safronov Date: Tue, 18 May 2021 20:12:49 +0300 Subject: [PATCH 09/13] new --- Dockerfile | 1 - 1 file changed, 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 0ce8daf..c85a44f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -36,6 +36,5 @@ RUN apk --no-cache add \ openssh-client \ rsync \ git \ - && \ COPY --from=builder /opt/ansible /opt/ansible CMD [ "ansible", "--version" ] -- GitLab From 1173f90ee9a75196dd70035682d13a11845d9d9c Mon Sep 17 00:00:00 2001 From: Dmitriy Safronov Date: Tue, 18 May 2021 20:14:59 +0300 Subject: [PATCH 10/13] new --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index c85a44f..a36fb93 100644 --- a/Dockerfile +++ b/Dockerfile @@ -35,6 +35,6 @@ RUN apk --no-cache add \ sshpass \ openssh-client \ rsync \ - git \ + git COPY --from=builder /opt/ansible /opt/ansible CMD [ "ansible", "--version" ] -- GitLab From 3e946500a96f8017e4a9e266c019dec30a667ee1 Mon Sep 17 00:00:00 2001 From: Dmitriy Safronov Date: Sat, 26 Jun 2021 13:28:25 +0300 Subject: [PATCH 11/13] 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 From f8a1719e1ec75a570819e102f883b9ef3c29ec0b Mon Sep 17 00:00:00 2001 From: Dmitriy Safronov Date: Sat, 26 Jun 2021 21:18:56 +0300 Subject: [PATCH 12/13] Dockerfile --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index e4d3c2c..da9acd9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,8 +16,8 @@ RUN apk --no-cache add python3 && \ wheel \ && \ ( test -z $ANSIBLE_VERSION && \ - pip install --ignore-installed --no-cache-dir ansible || \ - pip install --ignore-installed --no-cache-dir ansible\<=$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-lint \ -- GitLab From 51b7243f0ecc51b5bfa3bd81f1857c9ed9b32021 Mon Sep 17 00:00:00 2001 From: Dmitriy Safronov Date: Sat, 26 Jun 2021 21:33:35 +0300 Subject: [PATCH 13/13] Dockerfile --- Dockerfile | 37 +++++-------------------------------- 1 file changed, 5 insertions(+), 32 deletions(-) diff --git a/Dockerfile b/Dockerfile index da9acd9..bfb8510 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,45 +2,18 @@ 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 \ - musl-dev \ - python3-dev \ - libffi-dev \ - openssl-dev \ - cargo \ - && \ + apk --no-cache add --virtual build-dependencies musl-dev python3-dev libffi-dev openssl-dev cargo && \ python3 -m venv /opt/ansible && \ - pip3 install --ignore-installed --no-cache-dir --upgrade \ - pip \ - 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-lint \ - mitogen \ - jmespath \ - pywinrm \ - patch \ - && \ + pip3 install --ignore-installed --no-cache-dir --upgrade pip setuptools wheel && \ + export ANSIBLE_PACKAGES="pyyaml ansible-lint mitogen jmespath pywinrm patch" && \ + ( test -z $ANSIBLE_VERSION && pip install --ignore-installed --no-cache-dir ansible ${ANSIBLE_PACKAGES} || pip install --ignore-installed --no-cache-dir ansible\<=$ANSIBLE_VERSION ${ANSIBLE_PACKAGES} ) && \ #apk del build-dependencies && \ rm -rf /var/cache/apk/* FROM registry.cyberbrain.pw/docker/alpine:latest AS runtime ENV PATH="/opt/ansible/bin:$PATH" WORKDIR /srv/ansible -RUN apk --no-cache add \ - python3 \ - openssl \ - ca-certificates \ - sshpass \ - openssh-client \ - rsync \ - git \ - && \ +RUN apk --no-cache add python3 openssl ca-certificates sshpass openssh-client rsync git && \ rm -rf /var/cache/apk/* COPY --from=builder /opt/ansible /opt/ansible CMD [ "ansible", "--version" ] -- GitLab