FROM registry.cyberbrain.pw/tools/docker/alpine:latest AS base FROM base AS builder ARG ANSIBLE_BUILD_DEPENDENCIES="build-base cargo libffi-dev musl-dev openssl-dev python3-dev yaml-dev" ARG ANSIBLE_PACKAGES="ansible-lint hvac jinja2>=2.11 jmespath mitogen netaddr pyyaml pywinrm" ENV PATH="/opt/ansible/bin:$PATH" RUN apk --no-cache add python3 && \ apk --no-cache add --virtual build-dependencies ${ANSIBLE_BUILD_DEPENDENCIES} && \ python3 -m venv /opt/ansible && \ pip3 install --ignore-installed --no-cache-dir --upgrade --disable-pip-version-check pip setuptools wheel && \ pip3 install --ignore-installed --no-cache-dir ansible ${ANSIBLE_PACKAGES} && \ #apk del build-dependencies && \ rm -rf /var/cache/apk/* FROM base AS runtime ARG ANSIBLE_RUNTIME_DEPENDENCIES="ca-certificates git openssh-client openssl patch rsync sshpass yaml" ENV PATH="/opt/ansible/bin:$PATH" WORKDIR /srv/ansible RUN apk --no-cache add python3 && \ apk --no-cache add ${ANSIBLE_RUNTIME_DEPENDENCIES} && \ rm -rf /var/cache/apk/* COPY --from=builder /opt/ansible /opt/ansible CMD [ "ansible", "--version" ]