Skip to content
Snippets Groups Projects
Select Git revision
  • 070fe51a2510f67afce56aa2bf7adf5f4c1a78b1
  • main default protected
2 results

Dockerfile

Blame
  • Dockerfile 1.30 KiB
    ARG DOCKER_REGISTRY=registry.cyberbrain.pw
    FROM $DOCKER_REGISTRY/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} && \
        find /opt/ansible \( -type d -a -name test -o -name tests \) -o \( -type f -a -name '*.pyc' -o -name '*.pyo' \) -exec rm -rvf '{}' \+ && \
        #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" ]
    
    FROM runtime AS release