Loading

ansible dockerfile

包括了docker相关的模块功能

dockerfile

FROM python:3.12.2-alpine3.19

# ENV ANSIBLE_VER=2.16.4

RUN set -x \
       # Build dependencies
    && apk --no-cache add --virtual build-dependencies \
        gcc \
        musl-dev \
        python3-dev \
        libffi-dev \
        openssl-dev \
        cargo \
        build-base \
       # Useful tools
    && apk --no-cache add \
        bash \
        openssh-client \
        rsync \
    && pip install pip --upgrade \
    && pip install --no-cache-dir \
        ansible \
        docker \
        requests \
       # Some module need '/usr/bin/python' exist
    && ln -s -f /usr/local/bin/python3 /usr/bin/python \
    && ln -s -f /usr/local/bin/python3 /usr/bin/python3 \
       # Cleaning
    && apk del build-dependencies \
    && rm -rf /var/cache/apk/* \
    && rm -rf /root/.cache \
    && rm -rf /root/.cargo

CMD [ "sleep", "360000000" ]

构建镜像

docker build -t ansible:2.16.4 .
posted @ 2024-03-06 17:18  小维江湖  阅读(15)  评论(0编辑  收藏  举报