Skip to content

Commit

Permalink
Merge pull request #53 from dev-sec/2404
Browse files Browse the repository at this point in the history
add ubuntu 24.04
  • Loading branch information
rndmh3ro authored May 30, 2024
2 parents 5f8e889 + 327f382 commit 5711a85
Show file tree
Hide file tree
Showing 3 changed files with 124 additions and 0 deletions.
78 changes: 78 additions & 0 deletions .github/workflows/ubuntu2404-ansible-latest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: ubuntu2404-ansible-latest
on:
# yamllint disable-line rule:truthy
workflow_dispatch:
push:
paths:
- 'ubuntu2404-ansible-latest/**'
pull_request:
paths:
- 'ubuntu2404-ansible-latest/**'
jobs:
docker:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
strategy:
fail-fast: false
matrix:
dockerimage:
- ubuntu2404-ansible
platforms:
- linux/amd64
steps:
-
name: Checkout
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4
-
name: Set up QEMU
uses: docker/setup-qemu-action@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Build and export to Docker
uses: docker/build-push-action@v5
with:
context: ${{ matrix.dockerimage }}-latest
tags: docker-${{ matrix.dockerimage }}:test
load: true
platforms: ${{ matrix.platforms }}
-
name: Test
run: |
docker run --rm docker-${{ matrix.dockerimage }}:test
-
name: Login to ghcr.io
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
if: github.ref == 'refs/heads/master'
-
name: Build and push to ghcr.io
uses: docker/build-push-action@v5
with:
context: ${{ matrix.dockerimage }}-latest
push: true
tags: ghcr.io/dev-sec/docker-${{ matrix.dockerimage }}:latest
platforms: ${{ matrix.platforms }}
if: github.ref == 'refs/heads/master'
-
name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
if: github.ref == 'refs/heads/master'
-
name: Build and push
uses: docker/build-push-action@v5
with:
context: ${{ matrix.dockerimage }}-latest
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/docker-${{ matrix.dockerimage }}:latest
platforms: ${{ matrix.platforms }}
if: github.ref == 'refs/heads/master'
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ They are meant for testing purposes and are mainly used for [dev-sec](https://gi
| [Ubuntu 18.04][ubuntu] | [docker-ubuntu1804-ansible-latest][] | [ghcr.io/dev-sec/docker-ubuntu1804-ansible-latest][] | [rndmh3ro/docker-ubuntu1804-ansible-latest][] |
| [Ubuntu 20.04][ubuntu] | [docker-ubuntu2004-ansible-latest][] | [ghcr.io/dev-sec/docker-ubuntu2004-ansible-latest][] | [rndmh3ro/docker-ubuntu2004-ansible-latest][] |
| [Ubuntu 22.04][ubuntu] | [docker-ubuntu2204-ansible-latest][] | [ghcr.io/dev-sec/docker-ubuntu2204-ansible-latest][] | [rndmh3ro/docker-ubuntu2204-ansible-latest][] |
| [Ubuntu 24.04][ubuntu] | [docker-ubuntu2404-ansible-latest][] | [ghcr.io/dev-sec/docker-ubuntu2404-ansible-latest][] | [rndmh3ro/docker-ubuntu2404-ansible-latest][] |
| [Alpine][alpine] | [docker-alpine-ansible-latest][] | [ghcr.io/dev-sec/docker-alpine-ansible-latest][] | [rndmh3ro/docker-alpine-ansible-latest][] |
| [Amazon Linux 2][amazon] | [docker-amazon2-ansible-latest][] | [ghcr.io/dev-sec/docker-amazon2-ansible-latest][] | [rndmh3ro/docker-amazon2-ansible-latest][] |
| [Amazon Linux 2023][amazon] | [docker-amazon2023-ansible-latest][] | [ghcr.io/dev-sec/docker-amazon2023-ansible-latest][] | [rndmh3ro/docker-amazon2023-ansible-latest][] |
Expand Down Expand Up @@ -58,6 +59,7 @@ Sebastian Gumprich <[email protected]>
[docker-ubuntu1804-ansible-latest]: https://github.com/rndmh3ro/docker-ansible/blob/master/ubuntu1804-ansible-latest/Dockerfile
[docker-ubuntu2004-ansible-latest]: https://github.com/rndmh3ro/docker-ansible/blob/master/ubuntu2004-ansible-latest/Dockerfile
[docker-ubuntu2204-ansible-latest]: https://github.com/rndmh3ro/docker-ansible/blob/master/ubuntu2204-ansible-latest/Dockerfile
[docker-ubuntu2404-ansible-latest]: https://github.com/rndmh3ro/docker-ansible/blob/master/ubuntu2404-ansible-latest/Dockerfile
[docker-alpine-ansible-latest]: https://github.com/rndmh3ro/docker-ansible/blob/master/alpine-ansible-latest/Dockerfile
[docker-amazon2-ansible-latest]: https://github.com/rndmh3ro/docker-ansible/blob/master/amazon2-ansible-latest/Dockerfile
[docker-amazon2023-ansible-latest]: https://github.com/rndmh3ro/docker-ansible/blob/master/amazon2023-ansible-latest/Dockerfile
Expand All @@ -80,6 +82,7 @@ Sebastian Gumprich <[email protected]>
[ghcr.io/dev-sec/docker-ubuntu1804-ansible-latest]: https://github.com/dev-sec/docker-ansible/pkgs/container/docker-ubuntu1804-ansible
[ghcr.io/dev-sec/docker-ubuntu2004-ansible-latest]: https://github.com/dev-sec/docker-ansible/pkgs/container/docker-ubuntu2004-ansible
[ghcr.io/dev-sec/docker-ubuntu2204-ansible-latest]: https://github.com/dev-sec/docker-ansible/pkgs/container/docker-ubuntu2204-ansible
[ghcr.io/dev-sec/docker-ubuntu2404-ansible-latest]: https://github.com/dev-sec/docker-ansible/pkgs/container/docker-ubuntu2404-ansible
[ghcr.io/dev-sec/docker-alpine-ansible-latest]: https://github.com/dev-sec/docker-ansible/pkgs/container/docker-alpine-ansible
[ghcr.io/dev-sec/docker-amazon2-ansible-latest]: https://github.com/dev-sec/docker-ansible/pkgs/container/docker-amazon2-ansible
[ghcr.io/dev-sec/docker-amazon2023-ansible-latest]: https://github.com/dev-sec/docker-ansible/pkgs/container/docker-amazon2023-ansible
Expand All @@ -102,6 +105,7 @@ Sebastian Gumprich <[email protected]>
[rndmh3ro/docker-ubuntu1804-ansible-latest]: https://hub.docker.com/r/rndmh3ro/docker-ubuntu1804-ansible
[rndmh3ro/docker-ubuntu2004-ansible-latest]: https://hub.docker.com/r/rndmh3ro/docker-ubuntu2004-ansible
[rndmh3ro/docker-ubuntu2204-ansible-latest]: https://hub.docker.com/r/rndmh3ro/docker-ubuntu2204-ansible
[rndmh3ro/docker-ubuntu2404-ansible-latest]: https://hub.docker.com/r/rndmh3ro/docker-ubuntu2404-ansible
[rndmh3ro/docker-alpine-ansible-latest]: https://hub.docker.com/r/rndmh3ro/docker-alpine-ansible
[rndmh3ro/docker-amazon2-ansible-latest]: https://hub.docker.com/r/rndmh3ro/docker-amazon2-ansible
[rndmh3ro/docker-amazon2023-ansible-latest]: https://hub.docker.com/r/rndmh3ro/docker-amazon2023-ansible
Expand Down
42 changes: 42 additions & 0 deletions ubuntu2404-ansible-latest/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
FROM ubuntu:24.04
LABEL maintainer="Sebastian Gumprich"

# Install dependencies.
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
software-properties-common \
rsyslog systemd systemd-cron sudo \
&& rm -Rf /var/lib/apt/lists/* \
&& rm -Rf /usr/share/doc && rm -Rf /usr/share/man \
&& apt-get clean
RUN sed -i 's/^\($ModLoad imklog\)/#\1/' /etc/rsyslog.conf

# Install Ansible
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
ansible \
&& rm -rf /var/lib/apt/lists/* \
&& rm -Rf /usr/share/doc && rm -Rf /usr/share/man \
&& apt-get clean

# Install Ansible inventory file
RUN mkdir /etc/ansible \
&& echo "[local]\nlocalhost ansible_connection=local" > /etc/ansible/hosts

# https://molecule.readthedocs.io/en/latest/examples.html#docker-with-non-privileged-user
# Create `ansible` user with sudo permissions and membership in `DEPLOY_GROUP`
# This template gets rendered using `loop: "{{ molecule_yml.platforms }}"`, so
# each `item` is an element of platforms list from the molecule.yml file for this scenario.
ENV ANSIBLE_USER=ansible DEPLOY_GROUP=deployer SUDO_GROUP=sudo
RUN set -xe \
&& groupadd -r ${ANSIBLE_USER} \
&& groupadd -r ${DEPLOY_GROUP} \
&& useradd -m -g ${ANSIBLE_USER} ${ANSIBLE_USER} \
&& usermod -aG ${SUDO_GROUP} ${ANSIBLE_USER} \
&& usermod -aG ${DEPLOY_GROUP} ${ANSIBLE_USER} \
&& sed -i "/^%${SUDO_GROUP}/s/ALL\$/NOPASSWD:ALL/g" /etc/sudoers

# delete file created by systemd that prevents login via ssh
RUN rm -f /{var/run,etc,run}/nologin

CMD [ "ansible-playbook", "--version" ]

0 comments on commit 5711a85

Please sign in to comment.