Skip to content

Commit 0599bd1

Browse files
committed
feat: add fedora 40 image
Signed-off-by: Nejc Habjan <nejc.habjan@siemens.com>
1 parent 5049567 commit 0599bd1

2 files changed

Lines changed: 116 additions & 0 deletions

File tree

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: fedora40-ansible-latest
2+
on:
3+
# yamllint disable-line rule:truthy
4+
workflow_dispatch:
5+
push:
6+
paths:
7+
- 'fedora40-ansible-latest/**'
8+
pull_request:
9+
paths:
10+
- 'fedora40-ansible-latest/**'
11+
jobs:
12+
docker:
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: read
16+
packages: write
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
dockerimage:
21+
- fedora40-ansible
22+
platforms:
23+
- linux/amd64
24+
#- linux/arm64
25+
steps:
26+
-
27+
name: Checkout
28+
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4
29+
-
30+
name: Set up QEMU
31+
uses: docker/setup-qemu-action@v3
32+
-
33+
name: Set up Docker Buildx
34+
uses: docker/setup-buildx-action@v3
35+
-
36+
name: Build and export to Docker
37+
uses: docker/build-push-action@v5
38+
with:
39+
context: ${{ matrix.dockerimage }}-latest
40+
tags: docker-${{ matrix.dockerimage }}:test
41+
platforms: ${{ matrix.platforms }}
42+
load: true
43+
-
44+
name: Test
45+
run: |
46+
docker run --rm docker-${{ matrix.dockerimage }}:test
47+
-
48+
name: Login to ghcr.io
49+
uses: docker/login-action@v3
50+
with:
51+
registry: ghcr.io
52+
username: ${{ github.actor }}
53+
password: ${{ secrets.GITHUB_TOKEN }}
54+
if: github.ref == 'refs/heads/master'
55+
-
56+
name: Build and push to ghcr.io
57+
uses: docker/build-push-action@v5
58+
with:
59+
context: ${{ matrix.dockerimage }}-latest
60+
push: true
61+
tags: ghcr.io/dev-sec/docker-${{ matrix.dockerimage }}:latest
62+
platforms: ${{ matrix.platforms }}
63+
if: github.ref == 'refs/heads/master'
64+
-
65+
name: Login to DockerHub
66+
uses: docker/login-action@v3
67+
with:
68+
username: ${{ secrets.DOCKERHUB_USERNAME }}
69+
password: ${{ secrets.DOCKERHUB_TOKEN }}
70+
if: github.ref == 'refs/heads/master'
71+
-
72+
name: Build and push
73+
uses: docker/build-push-action@v5
74+
with:
75+
context: ${{ matrix.dockerimage }}-latest
76+
push: true
77+
tags: ${{ secrets.DOCKERHUB_USERNAME }}/docker-${{ matrix.dockerimage }}:latest
78+
platforms: ${{ matrix.platforms }}
79+
if: github.ref == 'refs/heads/master'

fedora40-ansible-latest/Dockerfile

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
FROM fedora:40
2+
LABEL maintainer="Sebastian Gumprich, Nejc Habjan, Diego Louzan, Max Wittig"
3+
4+
# Enable systemd.
5+
RUN dnf -y install systemd && dnf clean all && \
6+
for i in /lib/systemd/system/sysinit.target.wants/*; do [ $i == systemd-tmpfiles-setup.service ] || rm -f $i; done; \
7+
rm -f /lib/systemd/system/multi-user.target.wants/*;\
8+
rm -f /etc/systemd/system/*.wants/*;\
9+
rm -f /lib/systemd/system/local-fs.target.wants/*; \
10+
rm -f /lib/systemd/system/sockets.target.wants/*udev*; \
11+
rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \
12+
rm -f /lib/systemd/system/basic.target.wants/*;\
13+
rm -f /lib/systemd/system/anaconda.target.wants/*;
14+
15+
RUN dnf -y update \
16+
&& dnf -y install ansible python python3-libselinux \
17+
&& dnf clean all
18+
19+
RUN echo -e '[local]\nlocalhost ansible_connection=local' > /etc/ansible/hosts
20+
21+
# https://molecule.readthedocs.io/en/latest/examples.html#docker-with-non-privileged-user
22+
# Create `ansible` user with sudo permissions and membership in `DEPLOY_GROUP`
23+
# This template gets rendered using `loop: "{{ molecule_yml.platforms }}"`, so
24+
# each `item` is an element of platforms list from the molecule.yml file for this scenario.
25+
ENV ANSIBLE_USER=ansible DEPLOY_GROUP=deployer SUDO_GROUP=wheel
26+
RUN set -xe \
27+
&& groupadd -r ${ANSIBLE_USER} \
28+
&& groupadd -r ${DEPLOY_GROUP} \
29+
&& useradd -m -g ${ANSIBLE_USER} ${ANSIBLE_USER} \
30+
&& usermod -aG ${SUDO_GROUP} ${ANSIBLE_USER} \
31+
&& usermod -aG ${DEPLOY_GROUP} ${ANSIBLE_USER} \
32+
&& sed -i "/^%${SUDO_GROUP}/s/ALL\$/NOPASSWD:ALL/g" /etc/sudoers
33+
34+
# delete file created by systemd that prevents login via ssh
35+
RUN rm -f /{var/run,etc,run}/nologin
36+
37+
CMD [ "ansible-playbook", "--version" ]

0 commit comments

Comments
 (0)