feat: initial structure with rsyncd and telegraf-snmp images
This commit is contained in:
commit
46e0a70521
57
.gitea/workflows/rsyncd.yaml
Normal file
57
.gitea/workflows/rsyncd.yaml
Normal file
@ -0,0 +1,57 @@
|
||||
name: Build and push rsyncd image
|
||||
run-name: ${{ gitea.actor }} is building and pushing rsyncd image
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- 'rsyncd/**'
|
||||
- '.gitea/workflows/rsyncd.yaml'
|
||||
|
||||
env:
|
||||
RESULT_IMAGE_NAME: tools/rsyncd
|
||||
|
||||
jobs:
|
||||
build-and-push-image:
|
||||
runs-on: docker
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v5
|
||||
|
||||
- name: Log in to registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ vars.PRIVATE_REGISTRY_DOMAIN }}
|
||||
username: ${{ secrets.PRIVATE_REGISTRY_USER }}
|
||||
password: ${{ secrets.PRIVATE_REGISTRY_PASSWORD }}
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
|
||||
- name: Prepare BuildKit config with custom CA
|
||||
run: |
|
||||
CONFIG_DIR_PATH="${{ runner.temp }}/buildx-config"
|
||||
mkdir -p "${CONFIG_DIR_PATH}"
|
||||
|
||||
CERT_FILE_PATH="${CONFIG_DIR_PATH}/ca.crt"
|
||||
CONFIG_FILE_PATH="${CONFIG_DIR_PATH}/buildkitd.toml"
|
||||
|
||||
echo "${{ vars.PRIVATE_REGISTRY_CA_CERT }}" > "${CERT_FILE_PATH}"
|
||||
|
||||
cat << EOF > "${CONFIG_FILE_PATH}"
|
||||
[registry."${{ vars.PRIVATE_REGISTRY_DOMAIN }}"]
|
||||
ca = ["${CERT_FILE_PATH}"]
|
||||
EOF
|
||||
|
||||
echo "BUILDKIT_CONFIG=${CONFIG_FILE_PATH}" >> $GITEA_ENV
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
with:
|
||||
config: ${{ env.BUILDKIT_CONFIG }}
|
||||
|
||||
- name: Build and push image
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: rsyncd
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: true
|
||||
tags: ${{ vars.PRIVATE_REGISTRY_DOMAIN }}/${{ env.RESULT_IMAGE_NAME }}:latest
|
||||
57
.gitea/workflows/telegraf-snmp.yaml
Normal file
57
.gitea/workflows/telegraf-snmp.yaml
Normal file
@ -0,0 +1,57 @@
|
||||
name: Build and push telegraf-snmp image
|
||||
run-name: ${{ gitea.actor }} is building and pushing telegraf-snmp image
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- 'telegraf-snmp/**'
|
||||
- '.gitea/workflows/telegraf-snmp.yaml'
|
||||
|
||||
env:
|
||||
RESULT_IMAGE_NAME: tools/telegraf-snmp
|
||||
|
||||
jobs:
|
||||
build-and-push-image:
|
||||
runs-on: docker
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v5
|
||||
|
||||
- name: Log in to registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ vars.PRIVATE_REGISTRY_DOMAIN }}
|
||||
username: ${{ secrets.PRIVATE_REGISTRY_USER }}
|
||||
password: ${{ secrets.PRIVATE_REGISTRY_PASSWORD }}
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
|
||||
- name: Prepare BuildKit config with custom CA
|
||||
run: |
|
||||
CONFIG_DIR_PATH="${{ runner.temp }}/buildx-config"
|
||||
mkdir -p "${CONFIG_DIR_PATH}"
|
||||
|
||||
CERT_FILE_PATH="${CONFIG_DIR_PATH}/ca.crt"
|
||||
CONFIG_FILE_PATH="${CONFIG_DIR_PATH}/buildkitd.toml"
|
||||
|
||||
echo "${{ vars.PRIVATE_REGISTRY_CA_CERT }}" > "${CERT_FILE_PATH}"
|
||||
|
||||
cat << EOF > "${CONFIG_FILE_PATH}"
|
||||
[registry."${{ vars.PRIVATE_REGISTRY_DOMAIN }}"]
|
||||
ca = ["${CERT_FILE_PATH}"]
|
||||
EOF
|
||||
|
||||
echo "BUILDKIT_CONFIG=${CONFIG_FILE_PATH}" >> $GITEA_ENV
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
with:
|
||||
config: ${{ env.BUILDKIT_CONFIG }}
|
||||
|
||||
- name: Build and push image
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: telegraf-snmp
|
||||
platforms: linux/amd64
|
||||
push: true
|
||||
tags: ${{ vars.PRIVATE_REGISTRY_DOMAIN }}/${{ env.RESULT_IMAGE_NAME }}:latest
|
||||
14
rsyncd/Dockerfile
Normal file
14
rsyncd/Dockerfile
Normal file
@ -0,0 +1,14 @@
|
||||
FROM ubuntu:24.04
|
||||
LABEL org.opencontainers.image.authors="dockerimage@dresi.wtf"
|
||||
|
||||
RUN apt-get update && \
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install -yq --no-install-recommends rsync && \
|
||||
apt-get clean autoclean && \
|
||||
apt-get autoremove -y && \
|
||||
rm -rf /var/lib/{apt,dpkg,cache,log}/
|
||||
|
||||
EXPOSE 873
|
||||
VOLUME /volume
|
||||
ADD ./run.sh /usr/local/bin/run.sh
|
||||
RUN chmod +x /usr/local/bin/run.sh
|
||||
ENTRYPOINT ["/usr/local/bin/run.sh"]
|
||||
29
rsyncd/run.sh
Normal file
29
rsyncd/run.sh
Normal file
@ -0,0 +1,29 @@
|
||||
#!/bin/bash
|
||||
VOLUME=${VOLUME:-"volume"}
|
||||
ALLOW=${ALLOW:-192.168.0.0/16 172.16.0.0/12}
|
||||
OWNER=${OWNER:-nobody}
|
||||
GROUP=${GROUP:-nogroup}
|
||||
|
||||
# create users matching ids passed if necessary
|
||||
if [ "${GROUP}" != "nogroup" ]; then
|
||||
groupadd -g ${GROUP} rsyncdgroup
|
||||
fi
|
||||
if [ "${OWNER}" != "nobody" ]; then
|
||||
groupadd -u ${OWNER} -G rsyncdgroup rsyncduser
|
||||
fi
|
||||
|
||||
[ -f /etc/rsyncd.conf ] || cat <<EOF > /etc/rsyncd.conf
|
||||
uid = ${OWNER}
|
||||
gid = ${GROUP}
|
||||
use chroot = yes
|
||||
pid file = /var/run/rsyncd.pid
|
||||
log file = /dev/stdout
|
||||
[${VOLUME}]
|
||||
hosts deny = *
|
||||
hosts allow = ${ALLOW}
|
||||
read only = false
|
||||
path = /volume
|
||||
comment = ${VOLUME}
|
||||
EOF
|
||||
|
||||
exec /usr/bin/rsync --no-detach --daemon --config /etc/rsyncd.conf "$@"
|
||||
15
telegraf-snmp/Dockerfile
Normal file
15
telegraf-snmp/Dockerfile
Normal file
@ -0,0 +1,15 @@
|
||||
FROM telegraf:latest
|
||||
LABEL org.opencontainers.image.authors="dockerimage@dresi.wtf"
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get install -y --no-install-recommends snmp-mibs-downloader wget && \
|
||||
download-mibs 2>/dev/null || true && \
|
||||
wget -q -O /usr/share/snmp/mibs/UBNT-MIB \
|
||||
https://raw.githubusercontent.com/librenms/librenms/master/mibs/ubiquiti/UBNT-MIB && \
|
||||
wget -q -O /usr/share/snmp/mibs/UBNT-UniFi-MIB \
|
||||
https://raw.githubusercontent.com/librenms/librenms/master/mibs/ubiquiti/UBNT-UniFi-MIB && \
|
||||
echo "mibs +ALL" >> /etc/snmp/snmp.conf && \
|
||||
apt-get remove -y wget && \
|
||||
apt-get clean autoclean && \
|
||||
apt-get autoremove -y && \
|
||||
rm -rf /var/lib/{apt,dpkg,cache,log}/
|
||||
Loading…
Reference in New Issue
Block a user