Skip to content

Commit e3395b8

Browse files
authored
Merge pull request #37 from tronyx/develop
Develop
2 parents f1eec39 + 4f1c2f0 commit e3395b8

File tree

6 files changed

+217
-262
lines changed

6 files changed

+217
-262
lines changed

.github/workflows/build.yml

+20-102
Original file line numberDiff line numberDiff line change
@@ -13,56 +13,46 @@ on:
1313
jobs:
1414
build:
1515
if: "!contains(github.event.head_commit.message, 'skip ci')"
16-
runs-on: ubuntu-22.04
16+
runs-on: ubuntu-24.04
1717
strategy:
1818
matrix:
19-
architecture: [linux-amd64, linux-arm64, linux-arm-v7]
19+
architecture: [linux-amd64, linux-arm64]
2020
outputs:
2121
version: ${{ steps.prep.outputs.version }}
2222
branch: ${{ steps.prep.outputs.branch }}
23+
time: ${{ steps.vars.outputs.time }}
2324
steps:
2425
- name: Checkout
25-
uses: actions/checkout@v3
26+
uses: actions/checkout@v4
2627

2728
- name: Check if architecture exists
2829
id: arch_check
2930
run: |
3031
(test -f Dockerfile.${{ matrix.architecture }} && echo "check=passed" >> $GITHUB_OUTPUT) || echo "check=failed" >> $GITHUB_OUTPUT
3132
32-
# Workaround for Cargo issue: https://github.com/rust-lang/cargo/issues/8719
33-
- name: Set Swap Space
34-
uses: pierotofy/[email protected]
35-
with:
36-
swap-size-gb: 10
37-
- run: |
38-
sudo mkdir -p /var/lib/docker
39-
sudo mount -t tmpfs -o size=10G none /var/lib/docker
40-
sudo systemctl restart docker
41-
4233
- name: Set up QEMU
4334
if: "contains(steps.arch_check.outputs.check, 'passed')"
44-
uses: docker/setup-qemu-action@v2.1.0
35+
uses: docker/setup-qemu-action@v3.0.0
4536

4637
- name: Set up Docker Buildx
4738
if: "contains(steps.arch_check.outputs.check, 'passed')"
48-
uses: docker/setup-buildx-action@v2.4.1
39+
uses: docker/setup-buildx-action@v3.3.0
4940
with:
5041
install: true
5142
version: latest
52-
# Fix for https://github.com/docker/buildx/issues/1509
53-
driver-opts: image=moby/buildkit:v0.10.5 #:master
43+
driver-opts: image=moby/buildkit:master
5444

5545
- name: Login to docker.io
5646
if: "contains(steps.arch_check.outputs.check, 'passed')"
57-
uses: docker/login-action@v2.1.0
47+
uses: docker/login-action@v3.2.0
5848
with:
5949
registry: docker.io
6050
username: ${{ secrets.DOCKER_USERNAME }}
6151
password: ${{ secrets.DOCKER_PASSWORD }}
6252

6353
- name: Login to ghcr.io
6454
if: "contains(steps.arch_check.outputs.check, 'passed')"
65-
uses: docker/login-action@v2.1.0
55+
uses: docker/login-action@v3.2.0
6656
with:
6757
registry: ghcr.io
6858
username: ${{ github.repository_owner }}
@@ -96,41 +86,11 @@ jobs:
9686
9787
echo $GITHUB_OUTPUT
9888
99-
- name: Build and push - Attempt 1
89+
- name: Build and push
10090
continue-on-error: true
10191
if: "contains(steps.arch_check.outputs.check, 'passed')"
10292
id: build_attempt1
103-
uses: docker/[email protected]
104-
with:
105-
push: true
106-
platforms: ${{ steps.prep.outputs.platform }}
107-
file: ./Dockerfile.${{ matrix.architecture }}
108-
cache-from: docker.io/${{ steps.prep.outputs.cache }}
109-
cache-to: docker.io/${{ steps.prep.outputs.cache }}
110-
tags: |
111-
docker.io/${{ steps.prep.outputs.tag }}
112-
ghcr.io/${{ steps.prep.outputs.tag }}
113-
labels: |
114-
org.opencontainers.image.created=${{ steps.prep.outputs.created }}
115-
org.opencontainers.image.title=${{ steps.prep.outputs.title }}
116-
org.opencontainers.image.revision=${{ steps.prep.outputs.revision }}
117-
org.opencontainers.image.source=${{ steps.prep.outputs.source }}
118-
org.opencontainers.image.vendor=${{ steps.prep.outputs.vendor }}
119-
org.opencontainers.image.url=${{ steps.prep.outputs.url }}
120-
org.opencontainers.image.version=${{ steps.prep.outputs.version }}
121-
build-args: |
122-
GITHUB_TOKEN=${{ secrets.GHCR_TOKEN }}
123-
BUILD_ARCHITECTURE=${{ matrix.architecture }}
124-
${{ steps.prep.outputs.build-args }}
125-
126-
- name: Sleep
127-
if: (steps.build_attempt1.outcome == 'failure')
128-
run: |
129-
sleep 30
130-
131-
- name: Build and push - Attempt 2
132-
if: (steps.build_attempt1.outcome == 'failure')
133-
uses: docker/[email protected]
93+
uses: docker/[email protected]
13494
with:
13595
push: true
13696
platforms: ${{ steps.prep.outputs.platform }}
@@ -154,32 +114,32 @@ jobs:
154114
${{ steps.prep.outputs.build-args }}
155115
156116
publish:
157-
runs-on: ubuntu-22.04
117+
runs-on: ubuntu-24.04
158118
strategy:
159119
matrix:
160120
registry: [docker.io, ghcr.io]
161121
needs: [build]
162122
steps:
163123
- name: Checkout
164-
uses: actions/checkout@v3
124+
uses: actions/checkout@v4
165125

166126
- name: Login to docker.io
167127
if: matrix.registry == 'docker.io'
168-
uses: docker/login-action@v2.1.0
128+
uses: docker/login-action@v3.2.0
169129
with:
170130
registry: docker.io
171131
username: ${{ secrets.DOCKER_USERNAME }}
172132
password: ${{ secrets.DOCKER_PASSWORD }}
173133

174134
- name: Login to ghcr.io
175135
if: matrix.registry == 'ghcr.io'
176-
uses: docker/login-action@v2.1.0
136+
uses: docker/login-action@v3.2.0
177137
with:
178138
registry: ghcr.io
179139
username: ${{ github.repository_owner }}
180140
password: ${{ secrets.GHCR_TOKEN }}
181141

182-
- name: Create manifests - Attempt 1
142+
- name: Create manifests
183143
continue-on-error: true
184144
id: manifest_attempt1
185145
env:
@@ -189,50 +149,8 @@ jobs:
189149
TAG=${{ needs.build.outputs.branch }}
190150
SOURCE=${IMAGE}:${TAG}-${GITHUB_SHA:0:7}-${GITHUB_RUN_NUMBER}
191151
VERSION=${{ needs.build.outputs.version }}
192-
BRANCH=${{ needs.build.outputs.branch }}
193-
[[ -f Dockerfile.linux-amd64 ]] && AMD64=${SOURCE}-linux-amd64
194-
[[ -f Dockerfile.linux-arm64 ]] && ARM64=${SOURCE}-linux-arm64
195-
[[ -f Dockerfile.linux-arm-v7 ]] && ARMV7=${SOURCE}-linux-arm-v7
196-
docker manifest create ${IMAGE}:${TAG} ${AMD64} ${ARM64} ${ARMV7}
197-
docker manifest push ${IMAGE}:${TAG}
198-
docker manifest create ${IMAGE}:${TAG}-${VERSION} ${AMD64} ${ARM64} ${ARMV7}
199-
docker manifest push ${IMAGE}:${TAG}-${VERSION}
200-
docker manifest create ${IMAGE}:${TAG}-${VERSION} ${AMD64} ${ARM64} ${ARMV7}
201-
docker manifest push ${IMAGE}:${TAG}-${VERSION}
202-
if [[ ${BRANCH} == master ]]; then
203-
docker manifest create ${IMAGE}:latest ${AMD64} ${ARM64} ${ARMV7}
204-
docker manifest push ${IMAGE}:latest
205-
fi
206-
207-
- name: Sleep
208-
if: (steps.manifest_attempt1.outcome == 'failure')
209-
run: |
210-
sleep 30
211-
212-
- name: Create manifests - Attempt 2
213-
if: (steps.manifest_attempt1.outcome == 'failure')
214-
env:
215-
DOCKER_CLI_EXPERIMENTAL: enabled
216-
run: |
217-
IMAGE=${{ matrix.registry }}/$(echo ${GITHUB_REPOSITORY} | tr '[:upper:]' '[:lower:]' | sed s/docker-//)
218-
TAG=${{ needs.build.outputs.branch }}
219-
SOURCE=${IMAGE}:${TAG}-${GITHUB_SHA:0:7}-${GITHUB_RUN_NUMBER}
220-
VERSION=${{ needs.build.outputs.version }}
221-
BRANCH=${{ needs.build.outputs.branch }}
222-
[[ -f Dockerfile.linux-amd64 ]] && AMD64=${SOURCE}-linux-amd64
223-
[[ -f Dockerfile.linux-arm64 ]] && ARM64=${SOURCE}-linux-arm64
224-
[[ -f Dockerfile.linux-arm-v7 ]] && ARMV7=${SOURCE}-linux-arm-v7
225-
docker manifest rm ${IMAGE}:${TAG} || true
226-
docker manifest create ${IMAGE}:${TAG} ${AMD64} ${ARM64} ${ARMV7}
227-
docker manifest push ${IMAGE}:${TAG}
228-
docker manifest rm ${IMAGE}:${TAG}-${VERSION} || true
229-
docker manifest create ${IMAGE}:${TAG}-${VERSION} ${AMD64} ${ARM64} ${ARMV7}
230-
docker manifest push ${IMAGE}:${TAG}-${VERSION}
231-
docker manifest rm ${IMAGE}:${TAG}-${VERSION} || true
232-
docker manifest create ${IMAGE}:${TAG}-${VERSION} ${AMD64} ${ARM64} ${ARMV7}
233-
docker manifest push ${IMAGE}:${TAG}-${VERSION}
234-
if [[ ${BRANCH} == master ]]; then
235-
docker manifest rm ${IMAGE}:latest || true
236-
docker manifest create ${IMAGE}:latest ${AMD64} ${ARM64} ${ARMV7}
237-
docker manifest push ${IMAGE}:latest
152+
docker buildx imagetools create -t ${IMAGE}:${TAG} ${SOURCE}-linux-amd64 ${SOURCE}-linux-arm64
153+
docker buildx imagetools create -t ${IMAGE}:${TAG}-${VERSION} ${SOURCE}-linux-amd64 ${SOURCE}-linux-arm64
154+
if [[ ${GITHUB_REF//refs\/heads\//} == main ]]; then
155+
docker buildx imagetools create -t ${IMAGE}:latest ${SOURCE}-linux-amd64 ${SOURCE}-linux-arm64
238156
fi

Dockerfile.linux-amd64

+53-47
Original file line numberDiff line numberDiff line change
@@ -2,44 +2,43 @@
22
ARG BUILDKIT_SBOM_SCAN_CONTEXT=true
33
ARG BUILDKIT_SBOM_SCAN_STAGE=true
44

5-
FROM ubuntu:22.04
6-
7-
LABEL name="Nagios" \
8-
nagiosVersion="4.5.1" \
9-
nagiosPluginsVersion="2.4.9" \
10-
nrpeVersion="4.1.0" \
11-
nscaVersion="2.10.2" \
12-
ncpaVersion="3.0.2" \
13-
nagiostvVersion="0.8.7" \
14-
homepage="https://www.nagios.com/" \
15-
maintainer="Tronyx <[email protected]>"
5+
FROM ubuntu:24.04
6+
7+
LABEL name="Nagios"
8+
LABEL nagiosVersion="4.5.4"
9+
LABEL nagiosPluginsVersion="2.4.11"
10+
LABEL nrpeVersion="4.1.1"
11+
LABEL nscaVersion="2.10.3"
12+
LABEL ncpaVersion="3.1.0"
13+
LABEL nagiostvVersion="0.9.2"
14+
LABEL homepage="https://www.nagios.com/"
15+
LABEL maintainer="Tronyx <[email protected]>"
1616

1717
# Environment variables
18-
ENV NAGIOS_HOME=/opt/nagios \
19-
NAGIOS_USER=nagios \
20-
NAGIOS_GROUP=nagios \
21-
NAGIOS_CMDUSER=nagios \
22-
NAGIOS_CMDGROUP=nagios \
23-
NAGIOS_FQDN=nagios.example.com \
24-
NAGIOSADMIN_USER=nagiosadmin \
25-
NAGIOSADMIN_PASS=nagios \
26-
APACHE_RUN_USER=nagios \
27-
APACHE_RUN_GROUP=nagios \
28-
APACHE_LOCK_DIR=/var/run \
29-
APACHE_LOG_DIR=/var/log/apache2 \
30-
NAGIOS_TIMEZONE=UTC \
31-
DEBIAN_FRONTEND=noninteractive \
32-
NAGIOS_BRANCH=nagios-4.5.1 \
33-
NAGIOS_PLUGINS_BRANCH=release-2.4.9 \
34-
NRPE_BRANCH=nrpe-4.1.0 \
35-
NSCA_TAG=nsca-2.10.2 \
36-
NCPA_BRANCH=v3.0.2 \
37-
NAGIOSTV_VERSION=0.8.7
38-
39-
ENV NG_CGI_URL=/cgi-bin \
40-
NG_NAGIOS_CONFIG_FILE=${NAGIOS_HOME}/etc/nagios.cfg \
41-
NG_CGI_DIR=${NAGIOS_HOME}/sbin \
42-
NG_WWW_DIR=${NAGIOS_HOME}/share/nagiosgraph
18+
ENV NAGIOS_HOME=/opt/nagios
19+
ENV NAGIOS_USER=nagios
20+
ENV NAGIOS_GROUP=nagios
21+
ENV NAGIOS_CMDUSER=nagios
22+
ENV NAGIOS_CMDGROUP=nagios
23+
ENV NAGIOS_FQDN=nagios.example.com
24+
ENV NAGIOSADMIN_USER=nagiosadmin
25+
ENV NAGIOSADMIN_PASS=nagios
26+
ENV APACHE_RUN_USER=nagios
27+
ENV APACHE_RUN_GROUP=nagios
28+
ENV APACHE_LOCK_DIR=/var/run
29+
ENV APACHE_LOG_DIR=/var/log/apache2
30+
ENV NAGIOS_TIMEZONE=UTC
31+
ENV DEBIAN_FRONTEND=noninteractive
32+
ENV NG_CGI_URL=/cgi-bin
33+
ENV NG_NAGIOS_CONFIG_FILE=${NAGIOS_HOME}/etc/nagios.cfg
34+
ENV NG_CGI_DIR=${NAGIOS_HOME}/sbin
35+
ENV NG_WWW_DIR=${NAGIOS_HOME}/share/nagiosgraph
36+
ENV NAGIOS_BRANCH=nagios-4.5.4
37+
ENV NAGIOS_PLUGINS_BRANCH=release-2.4.11
38+
ENV NRPE_BRANCH=nrpe-4.1.1
39+
ENV NSCA_TAG=nsca-2.10.3
40+
ENV NCPA_BRANCH=v3.1.0
41+
ENV NAGIOSTV_VERSION=0.9.2
4342

4443
RUN echo postfix postfix/main_mailer_type string "'Internet Site'" | debconf-set-selections && \
4544
echo postfix postfix/mynetworks string "127.0.0.0/8" | debconf-set-selections && \
@@ -56,6 +55,7 @@ RUN echo postfix postfix/main_mailer_type string "'Internet Site'" | debconf-set
5655
bsd-mailx \
5756
build-essential \
5857
ca-certificates \
58+
curl \
5959
dnsutils \
6060
fping \
6161
freetds-dev \
@@ -69,6 +69,7 @@ RUN echo postfix postfix/main_mailer_type string "'Internet Site'" | debconf-set
6969
libcgi-pm-perl \
7070
libcrypt-des-perl \
7171
libcrypt-rijndael-perl \
72+
libcrypt-x509-perl \
7273
libdbd-mysql-perl \
7374
libdbd-pg-perl \
7475
libdbi-dev \
@@ -81,30 +82,31 @@ RUN echo postfix postfix/main_mailer_type string "'Internet Site'" | debconf-set
8182
libgd-gd2-perl \
8283
libjson-perl \
8384
libldap2-dev \
84-
libmysqlclient-dev \
85+
libmariadb-dev \
8586
libnagios-object-perl \
8687
libmonitoring-plugin-perl \
8788
libnet-snmp-perl \
8889
libnet-tftp-perl \
8990
libnet-xmpp-perl \
9091
libpq-dev \
91-
libpython2-dev \
9292
libpython3-dev \
9393
libredis-perl \
9494
librrds-perl \
9595
libssl-dev \
9696
libswitch-perl \
97+
libtext-glob-perl \
9798
libwww-perl \
9899
m4 \
99-
netcat \
100+
netcat-traditional \
100101
openssh-client \
101102
parallel \
102103
php-cli \
103104
php-gd \
104105
postfix \
105-
python2 \
106-
python3-pip \
106+
python3-full \
107107
python3-nagiosplugin \
108+
python3-pip \
109+
python3-venv \
108110
rsync \
109111
rsyslog \
110112
runit \
@@ -219,11 +221,11 @@ RUN cd /tmp && \
219221

220222
# Install additional plugins
221223
RUN cd /opt && \
222-
wget -q -O get-pip.py https://bootstrap.pypa.io/pip/2.7/get-pip.py && \
223-
python2 get-pip.py && \
224-
pip install --no-cache-dir "pymssql<2.2.0" && \
225-
pip3 install --no-cache-dir --find-links https://wheel-index.linuxserver.io/ubuntu/ pywbem paramiko pplogger paho-mqtt && \
226-
pip3 install --no-cache-dir --find-links https://wheel-index.linuxserver.io/ubuntu/ --upgrade requests && \
224+
#python3 -m venv .venv && \
225+
#. .venv/bin/activate && \
226+
pip3 install --break-system-packages --no-cache-dir pymssql && \
227+
pip3 install --break-system-packages --no-cache-dir --find-links https://wheel-index.linuxserver.io/ubuntu/ pywbem paramiko pplogger paho-mqtt && \
228+
pip3 install --break-system-packages --no-cache-dir --find-links https://wheel-index.linuxserver.io/ubuntu/ --upgrade requests && \
227229
git clone https://github.com/willixix/naglio-plugins.git WL-Nagios-Plugins && \
228230
git clone https://github.com/JasonRivers/nagios-plugins.git JR-Nagios-Plugins && \
229231
git clone https://github.com/justintime/nagios-plugins.git JE-Nagios-Plugins && \
@@ -286,9 +288,13 @@ RUN echo "use_timezone=${NAGIOS_TIMEZONE}" >> ${NAGIOS_HOME}/etc/nagios.cfg
286288
# Copy example config in-case the user has started with empty var or etc
287289
RUN mkdir -p /orig/var && \
288290
mkdir -p /orig/etc && \
291+
mkdir -p /orig/graph-etc && \
292+
mkdir -p /orig/graph-var && \
289293
mkdir -p /orig/xinetd.d && \
290294
cp -Rp ${NAGIOS_HOME}/var/* /orig/var/ && \
291295
cp -Rp ${NAGIOS_HOME}/etc/* /orig/etc/ && \
296+
cp -Rp /opt/nagiosgraph/etc/* /orig/graph-etc && \
297+
cp -Rp /opt/nagiosgraph/var/* /orig/graph-var && \
292298
cp -Rp /etc/xinetd.d/* /orig/xinetd.d/
293299

294300
## Set the permissions for example config
@@ -310,7 +316,7 @@ RUN cd /opt/nagiosgraph/etc && \
310316
sh fix-nagiosgraph-multiple-selection.sh
311317

312318
# Enable all runit services
313-
RUN ln -s /etc/sv/* /etc/service
319+
RUN ln -sf /etc/sv/* /etc/service
314320

315321
# Fix ping permissions for Nagios user
316322
RUN chmod u+s /usr/bin/ping

0 commit comments

Comments
 (0)