55 lines
1.9 KiB
Docker
55 lines
1.9 KiB
Docker
### FROM ubuntu:24.04
|
||
FROM public.ecr.aws/docker/library/ubuntu:24.04
|
||
|
||
|
||
ENV DEBIAN_FRONTEND=noninteractive
|
||
ENV TZ=Africa/Johannesburg
|
||
|
||
# OS deps
|
||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||
tzdata \
|
||
python3 python3-venv python3-pip \
|
||
openssh-client sshpass netcat-traditional \
|
||
vim gawk \
|
||
jq curl ca-certificates git \
|
||
&& ln -snf /usr/share/zoneinfo/$TZ /etc/localtime \
|
||
&& echo $TZ > /etc/timezone \
|
||
&& dpkg-reconfigure -f noninteractive tzdata \
|
||
&& rm -rf /var/lib/apt/lists/*
|
||
|
||
ENV APP_DIR=/opt/containers/ansible-worker
|
||
ENV DATA_DIR=${APP_DIR}/data
|
||
ENV VENV_DIR=${DATA_DIR}/ansible_venv
|
||
|
||
# Copy your Ansible project files into the image (immutable)
|
||
# Expecting host: ./files/{ansible.cfg, inventory/, group_vars/, ...}
|
||
COPY files/ ${APP_DIR}/app/
|
||
|
||
# Entry script will bootstrap the venv into DATA_DIR if missing
|
||
COPY files/entrypoint.sh /usr/local/bin/ansible-entrypoint
|
||
RUN chmod +x /usr/local/bin/ansible-entrypoint
|
||
|
||
# Default config paths
|
||
ENV ANSIBLE_CONFIG=${APP_DIR}/app/ansible.cfg
|
||
# Optional: speed up password auth on Dropbear/OpenWrt devices
|
||
ENV ANSIBLE_SSH_ARGS="-o PubkeyAuthentication=no"
|
||
|
||
# put the venv on PATH for all processes (incl. docker exec sessions)
|
||
ENV PATH="/opt/containers/ansible-worker/data/ansible_venv/bin:${PATH}"
|
||
|
||
# keep collections in persistent storage
|
||
#ENV ANSIBLE_COLLECTIONS_PATHS="/opt/containers/ansible-worker/data/collections:/usr/share/ansible/collections"
|
||
ENV ANSIBLE_COLLECTIONS_PATH="/opt/containers/ansible-worker/data/collections:/usr/share/ansible/collections"
|
||
|
||
ENV QUEUE="queue_deviceconfig,queue_persuasive"
|
||
|
||
# Work from the "app" dir; data/ is mounted separately
|
||
WORKDIR ${APP_DIR}/app
|
||
|
||
# Keep container alive by default; entrypoint sets up venv+PATH
|
||
ENTRYPOINT ["/usr/local/bin/ansible-entrypoint"]
|
||
#CMD ["sleep", "infinity"]
|
||
|
||
# …or, if it’s under bin and named rabbitmq-client.sh as you hinted:
|
||
CMD ["/opt/containers/ansible-worker/app/bin/rabbitmq-client.sh"]
|