Skip to content

Commit 5b29a0a

Browse files
author
Your Name
committed
init
1 parent a026604 commit 5b29a0a

File tree

3 files changed

+200
-0
lines changed

3 files changed

+200
-0
lines changed
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
name: "centos stream docker nagios CI workflow"
2+
3+
4+
on:
5+
push:
6+
branches: [ test ]
7+
8+
9+
jobs:
10+
11+
centos-9-nagios-job:
12+
name: "nagios centos stream 9 image ubuntu latest"
13+
runs-on: ubuntu-latest
14+
env:
15+
version: "latest"
16+
name: "centos-stream9/nagios"
17+
dockerdir: "dockerfiles/3"
18+
dockerfile: "Dockerfile.centos.stream9"
19+
steps:
20+
- uses: actions/checkout@v2
21+
- name: "os fingerprinting"
22+
run: |
23+
hostnamectl status
24+
lsb_release -a
25+
lsb_release -d
26+
cat /etc/lsb-release
27+
cat /etc/issue
28+
cat /etc/os-release
29+
sudo apt-get install -y neofetch && neofetch
30+
- name: "docker build nagios base"
31+
run: |
32+
# destroyed afterwards (use --rm )
33+
# all subsequent Dockerfile commands generate new images and the cache is not used
34+
sudo docker build --no-cache --rm -t ${name}:${version} . --file ${dockerdir}/${dockerfile}
35+
docker image ls
36+
docker image history ${name}:${version}
37+
docker system df -v
38+
docker image inspect ${name}:${version}
39+
- name: "docker scan trivy archlinux base "
40+
run: |
41+
# destroyed afterwards (use --rm )
42+
# all subsequent Dockerfile commands generate new images and the cache is not used
43+
sudo docker build --no-cache --rm -t ${name}:${version} . --file ${dockerdir}/${dockerfile}
44+
curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/master/contrib/install.sh | sudo sh -s -- -b /usr/local/bin
45+
trivy image ${name}:${version}
46+
47+
centos-8-nagios-job:
48+
name: "nagios centos stream 8 image ubuntu latest"
49+
runs-on: ubuntu-latest
50+
env:
51+
version: "latest"
52+
name: "centos-stream9/nagios"
53+
dockerdir: "dockerfiles/3"
54+
dockerfile: "Dockerfile.centos.stream8"
55+
steps:
56+
- uses: actions/checkout@v2
57+
- name: "os fingerprinting"
58+
run: |
59+
hostnamectl status
60+
lsb_release -a
61+
lsb_release -d
62+
cat /etc/lsb-release
63+
cat /etc/issue
64+
cat /etc/os-release
65+
sudo apt-get install -y neofetch && neofetch
66+
- name: "docker build nagios base"
67+
run: |
68+
# destroyed afterwards (use --rm )
69+
# all subsequent Dockerfile commands generate new images and the cache is not used
70+
sudo docker build --no-cache --rm -t ${name}:${version} . --file ${dockerdir}/${dockerfile}
71+
docker image ls
72+
docker image history ${name}:${version}
73+
docker system df -v
74+
docker image inspect ${name}:${version}
75+
- name: "docker scan trivy archlinux base "
76+
run: |
77+
# destroyed afterwards (use --rm )
78+
# all subsequent Dockerfile commands generate new images and the cache is not used
79+
sudo docker build --no-cache --rm -t ${name}:${version} . --file ${dockerdir}/${dockerfile}
80+
curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/master/contrib/install.sh | sudo sh -s -- -b /usr/local/bin
81+
trivy image ${name}:${version}
82+
83+
84+
85+
86+
87+
88+
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
#https://quay.io/repository/centos/centos?tag=stream8&tab=tags
2+
FROM quay.io/centos/centos:stream8
3+
4+
LABEL org.opencontainers.image.authors="githubfoam"
5+
6+
ENV NAGIOS_USER nagios
7+
ENV NAGIOS_GROUP nagios
8+
ENV NAGIOS_WEB_USER nagiosadmin
9+
ENV NAGIOS_WEB_PASS adminpass
10+
ENV NAGIOS_HOME "/usr/local/nagios"
11+
12+
# verify centos stream8
13+
RUN echo "================os-release=======================" && \
14+
echo "=================================================" && \
15+
cat /etc/os-release && \
16+
echo "=================================================" && \
17+
echo "================os-release======================="
18+
19+
RUN yum update -yq && \
20+
yum clean all && \
21+
yum autoremove -yq && \
22+
rm -rf /var/cache/*/*
23+
24+
RUN yum update -yq && \
25+
yum clean all && \
26+
yum autoremove -yq && \
27+
rm -rf /var/cache/*/* && \
28+
# ---- make sure NAGIOS_HOME exists
29+
mkdir -p ${NAGIOS_HOME} && \
30+
#mkdir -p /usr/local/nagios && \
31+
# ---- ensure user existence before provision
32+
groupadd ${NAGIOS_GROUP} && \
33+
useradd --system -d ${NAGIOS_HOME} -g ${NAGIOS_GROUP} ${NAGIOS_USER}
34+
35+
# RUN echo "============================Setup Pre-requsites==============" && \
36+
# # Set SELinux in permissive mode
37+
# #current mode of SELinux
38+
# yum install policycoreutils -y && \
39+
# sestatus && \
40+
# #current mode of SELinux
41+
# getenforce && \
42+
# # sed: can't read /etc/selinux/config: No such file or directory
43+
# sed -i 's/SELINUX=.*/SELINUX=permissive/g' /etc/selinux/config && \
44+
# setenforce 0 && \
45+
# #current mode of SELinux
46+
# sestatus && \
47+
# #current mode of SELinux
48+
# getenforce
49+
50+
RUN echo "============================Install dependencies=============================================================" && \
51+
dnf update -y && \
52+
dnf install -y @php && \
53+
dnf install -y @perl @httpd wget unzip glibc automake glibc-common gettext autoconf php php-cli gcc gd gd-devel net-snmp openssl-devel unzip net-snmp postfix net-snmp-utils && \
54+
dnf groupinstall -y "Development Tools"
55+
# systemctl enable --now httpd php-fpm
56+
# systemctl enable --now httpd php-fpm && \
57+
# systemctl status php-fpm && \
58+
# systemctl status httpd
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#https://quay.io/repository/centos/centos?tag=stream8&tab=tags
2+
FROM quay.io/centos/centos:stream9
3+
4+
LABEL org.opencontainers.image.authors="githubfoam"
5+
6+
ENV NAGIOS_USER nagios
7+
ENV NAGIOS_GROUP nagios
8+
ENV NAGIOS_WEB_USER nagiosadmin
9+
ENV NAGIOS_WEB_PASS adminpass
10+
ENV NAGIOS_HOME "/usr/local/nagios"
11+
12+
13+
# verify centos stream9
14+
RUN echo "================os-release=======================" && \
15+
echo "=================================================" && \
16+
cat /etc/os-release && \
17+
echo "=================================================" && \
18+
echo "================os-release======================="
19+
20+
RUN yum update -yq && \
21+
yum clean all && \
22+
yum autoremove -yq && \
23+
rm -rf /var/cache/*/* && \
24+
# ---- make sure NAGIOS_HOME exists
25+
mkdir -p ${NAGIOS_HOME} && \
26+
#mkdir -p /usr/local/nagios && \
27+
# ---- ensure user existence before provision
28+
groupadd ${NAGIOS_GROUP} && \
29+
useradd --system -d ${NAGIOS_HOME} -g ${NAGIOS_GROUP} ${NAGIOS_USER}
30+
31+
# RUN echo "============================Setup Pre-requsites==============" && \
32+
# # Set SELinux in permissive mode
33+
# #current mode of SELinux
34+
# yum install policycoreutils -y && \
35+
# sestatus && \
36+
# #current mode of SELinux
37+
# getenforce && \
38+
# # sed: can't read /etc/selinux/config: No such file or directory
39+
# sed -i 's/SELINUX=.*/SELINUX=permissive/g' /etc/selinux/config && \
40+
# setenforce 0 && \
41+
# #current mode of SELinux
42+
# sestatus && \
43+
# #current mode of SELinux
44+
# getenforce
45+
46+
RUN echo "============================Install dependencies=============================================================" && \
47+
dnf update -y
48+
# Module or Group 'php' is not available.
49+
# dnf install -y @php && \
50+
# dnf install -y @perl @httpd wget unzip glibc automake glibc-common gettext autoconf php php-cli gcc gd gd-devel net-snmp openssl-devel unzip net-snmp postfix net-snmp-utils && \
51+
# dnf groupinstall -y "Development Tools" && \
52+
# systemctl enable --now httpd php-fpm && \
53+
# systemctl status php-fpm && \
54+
# systemctl status httpd

0 commit comments

Comments
 (0)