forked from ansible/ansible-docker-base
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile.debian
32 lines (28 loc) · 1.13 KB
/
Dockerfile.debian
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
ARG DEBIAN_VERSION=latest
FROM debian:$DEBIAN_VERSION as builder
ARG LIBSSL=openssl-dev
ARG ANSIBLE_VERSION
ARG ANSIBLE_VERSION_MAX
# Don't write .pyc files
ENV PYTHONDONTWRITEBYTECODE=1
# Force the stdout and stderr streams to be unbuffered
ENV PYTHONUNBUFFERED=1
ENV PATH="/ansible-venv/bin:$PATH"
ENV DEBIAN_FRONTEND=noninteractive
# Install build deps
RUN apt-get update && apt-get install -y python3-dev python3-pip \
python3-venv curl build-essential ${LIBSSL} && \
python3 -m venv /ansible-venv
# Install rust for python packages(cryptography)
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
ENV PATH="$HOME/.cargo/bin:$PATH"
# Install ansible via pip
RUN pip install pip setuptools wheel --upgrade && \
pip install "ansible>=${ANSIBLE_VERSION},<${ANSIBLE_VERSION_MAX}" --upgrade
# Image with python and ansible
FROM debian:$DEBIAN_VERSION
ENV PATH="/ansible-venv/bin:$PATH"
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y --no-install-recommends python3 && \
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/
COPY --from=builder /ansible-venv /ansible-venv