Skip to content

Commit

Permalink
Merge pull request #11 from Think-Cube/patch-2
Browse files Browse the repository at this point in the history
Patch 2
  • Loading branch information
spy86 authored Feb 27, 2024
2 parents 437cdab + c1f466e commit 4f1a655
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 14 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
37 changes: 27 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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" ]
14 changes: 10 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 4f1a655

Please sign in to comment.