File tree Expand file tree Collapse file tree 4 files changed +65
-0
lines changed Expand file tree Collapse file tree 4 files changed +65
-0
lines changed Original file line number Diff line number Diff line change 1+ # https://docs.docker.com/engine/reference/builder/
2+
3+ # https://hub.docker.com/_/debian
4+ FROM debian:bookworm-slim
5+
6+ # Configure apt not to prompt during docker build
7+ ARG DEBIAN_FRONTEND=noninteractive
8+
9+ # Configure apt to avoid installing recommended and suggested packages
10+ RUN apt-config dump \
11+ | grep -E '^APT::Install-(Recommends|Suggests)' \
12+ | sed -e's/1/0/' \
13+ | tee /etc/apt/apt.conf.d/99no-recommends-no-suggests
14+
15+ # Resynchronize the package index files from their sources
16+ RUN apt-get update
17+
18+ # Install packages
19+ RUN apt-get install -y \
20+ python3 \
21+ python3-pip \
22+ python3-venv \
23+ openssh-client
24+
25+ # Clean up packages: Saves space by removing unnecessary package files
26+ # and lists
27+ RUN apt-get clean
28+ RUN rm -rf /var/lib/apt/lists/*
29+
30+ # Create a virtual env and install ansible using pip
31+ RUN python3 -m venv /opt/ansible-venv --system-site-packages && \
32+ /opt/ansible-venv/bin/pip install --no-cache-dir ansible
33+
34+ # Create a directory for Ansible configuration
35+ RUN mkdir /etc/ansible/
36+
37+ # Copy local configuration files to the image
38+ COPY ../config/ /etc/ansible/
39+
40+ # Set environment variables for Ansible
41+ ENV PATH="/ansible-venv/bin:$PATH"
42+ ENV ANSIBLE_CONFIG=/etc/ansible/ansible.cfg
43+
44+ # Set the default command to run Ansible
45+ CMD ["ansible" , "--version" ]
Original file line number Diff line number Diff line change 1+ [defaults]
2+ inventory = /etc/ansible/hosts
3+ remote_user = root
4+ host_key_checking = False
5+ retry_files_enabled = False
Original file line number Diff line number Diff line change 1+ [local]
2+ localhost ansible_connection=local
Original file line number Diff line number Diff line change 1+ # https://docs.docker.com/compose/compose-file/
2+
3+ services :
4+
5+ ansible-dev :
6+ container_name : ansible
7+ build :
8+ context : .
9+ dockerfile : ansible/Dockerfile
10+ volumes :
11+ - ./config/ansible.cfg:/etc/ansible/ansible.cfg
12+ - ./config/hosts:/etc/ansible/hosts
13+ command : sh -c 'trap "exit" TERM; while true; do sleep 1; done'
You can’t perform that action at this time.
0 commit comments