From 85187caaaf36b7fec1a1f3a0bc5393569c30a1ca Mon Sep 17 00:00:00 2001 From: Maciej Michalski <5445923+spy86@users.noreply.github.com> Date: Tue, 27 Feb 2024 22:13:47 +0100 Subject: [PATCH 1/3] Update Dockerfile --- Dockerfile | 37 +++++++++++++++++++++++++++---------- 1 file changed, 27 insertions(+), 10 deletions(-) diff --git a/Dockerfile b/Dockerfile index 4ea060f..8d7505c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,13 +1,30 @@ -FROM debian:12 +FROM ubuntu:22.04 -RUN apt-get update \ - && apt-get install --no-install-recommends -y python3-pip \ - && rm -rf /var/lib/apt/lists/* -RUN pip install pip --upgrade -RUN pip install ansible +ARG ANSIBLE_CORE_VERSION +ARG ANSIBLE_VERSION +ARG ANSIBLE_LINT +ENV ANSIBLE_CORE_VERSION ${ANSIBLE_CORE_VERSION} +ENV ANSIBLE_VERSION ${ANSIBLE_VERSION} +ENV ANSIBLE_LINT ${ANSIBLE_LINT} -RUN apt-get update -y && \ - DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ - sshpass +LABEL maintainer="contact@thinkcube.dev" -WORKDIR /work +RUN DEBIAN_FRONTEND=noninteractive apt-get update && \ + apt-get install -y gnupg2 python3-pip sshpass git openssh-client && \ + rm -rf /var/lib/apt/lists/* && \ + apt-get clean + +RUN python3 -m pip install --upgrade pip cffi && \ + pip3 install ansible-core==${ANSIBLE_CORE_VERSION} && \ + pip3 install ansible==${ANSIBLE_VERSION} ansible-lint==${ANSIBLE_LINT} && \ + pip3 install mitogen jmespath && \ + pip install --upgrade pywinrm && \ + rm -rf /root/.cache/pip + +RUN mkdir /ansible && \ + mkdir -p /etc/ansible && \ + echo 'localhost' > /etc/ansible/hosts + +WORKDIR /ansible + +CMD [ "ansible-playbook", "--version" ] From d36f847051470ba7d8650f2b5fc24e3f11904e41 Mon Sep 17 00:00:00 2001 From: Maciej Michalski <5445923+spy86@users.noreply.github.com> Date: Tue, 27 Feb 2024 22:20:32 +0100 Subject: [PATCH 2/3] Update docker-publish.yml --- .github/workflows/docker-publish.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 5f30c53..338453e 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -5,6 +5,9 @@ on: env: REGISTRY: ghcr.io IMAGE_NAME: ${{ github.repository }} + ANSIBLE_CORE_VERSION: 2.16.3 + ANSIBLE_VERSION: 9.2.0 + ANSIBLE_LINT: 6.22.2 jobs: build: runs-on: ubuntu-latest @@ -44,6 +47,10 @@ jobs: labels: ${{ steps.meta.outputs.labels }} cache-from: type=gha cache-to: type=gha,mode=max + build-args: | + ANSIBLE_CORE_VERSION=2.16.3 + ANSIBLE_VERSION=9.2.0 + ANSIBLE_LINT=6.22.2 - name: Sign the published Docker image if: ${{ github.event_name != 'pull_request' }} env: From c1f466e80cafd226f93a83dbf85ad0752957235f Mon Sep 17 00:00:00 2001 From: Maciej Michalski <5445923+spy86@users.noreply.github.com> Date: Tue, 27 Feb 2024 22:23:41 +0100 Subject: [PATCH 3/3] Update README.md --- README.md | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index e63841a..a8d689e 100644 --- a/README.md +++ b/README.md @@ -27,10 +27,16 @@ This repository houses a Dockerfile for creating a Docker image tailored for Ans The Dockerfile follows these major steps: -1. Update package lists and install Python 3 and Pip. -2. Upgrade Pip and install Ansible. -3. Install `sshpass` for SSH password support. -4. Set the working directory to `/work`. +1. Update package lists and install required dependencies. +2. Install and configure Python, Pip, and other necessary tools. +3. Install specified versions of Ansible, Ansible Core, and Ansible Lint. +4. Set up the working directory and essential Ansible files. + +## Environment Variables + +* `ANSIBLE_CORE_VERSION`: Version of Ansible Core. +* `ANSIBLE_VERSION`: Version of Ansible. +* `ANSIBLE_LINT`: Version of Ansible Lint. ## License