refactor: standardize Dockerfile and build script structure

Standardize all RPM packages to use a consistent build pattern:
- Simple Dockerfiles that copy resources/ and call build.sh
- Move all build logic to resources/build.sh scripts
- Consolidate nfpm.yaml and scripts into resources/ directory
- Update base image to almalinux9-rpmbuilder for consistency

Changes:
- Refactored 37 packages total (simple + complex)
- HashiCorp tools: consul, vault, terraform, terragrunt, packer, nomad, nomad-autoscaler
- Development tools: g10k, etcd, nfpm, ruff, uv, unrar, nzbget, boilerplate
- VictoriaMetrics: vlutils, vmutils, victoria-logs
- Network tools: cni-plugins, consul-cni, unkin-ca-certificates
- Jellyfin suite: jellyfin-web, jellyfin-server, jellyfin-ffmpeg-bin
- System packages: puppet-initial, incus

This standardization improves maintainability and consistency across
the entire RPM build system while preserving all existing functionality.
This commit is contained in:
2025-09-28 22:17:46 +10:00
parent 20952727ba
commit 325b830952
85 changed files with 389 additions and 269 deletions
+2 -39
View File
@@ -1,4 +1,3 @@
# Start with the AlmaLinux 8.10 base image
FROM git.unkin.net/unkin/almalinux9-rpmbuilder:latest
# Create output directory for RPMs
@@ -12,44 +11,8 @@ ENV PACKAGE_RELEASE=${PACKAGE_RELEASE}
ARG PACKAGE_VERSION
ENV PACKAGE_VERSION=${PACKAGE_VERSION}
COPY scripts /app/scripts
# Copy resources from the context into the container
COPY resources /app/resources
# Download the required files
RUN dnf install -y \
unzip \
libtool \
autoconf \
automake \
gcc \
make \
git \
go \
cowsql-devel \
libacl-devel \
libcap-devel \
libseccomp-devel \
libuv-devel \
raft-devel \
libudev-devel \
lxc-devel \
libsqlite3x-devel \
sqlite-devel \
systemd-rpm-macros \
bash-completion \
gettext \
help2man \
wget && \
wget -O /app/incus.tar.gz https://github.com/lxc/incus/archive/refs/tags/v${PACKAGE_VERSION}.tar.gz && tar -C /app -xf incus.tar.gz && \
wget https://go.dev/dl/go1.24.1.linux-amd64.tar.gz && rm -rf /usr/local/go && tar -C /usr/local -xzf go1.24.1.linux-amd64.tar.gz && \
export PATH=/usr/local/go/bin:$PATH && \
pushd /app/incus-${PACKAGE_VERSION} && \
make deps && \
export CGO_CFLAGS="-I/root/go/deps/raft/include/ -I/root/go/deps/cowsql/include/" && \
export CGO_LDFLAGS="-L/root/go/deps/raft/.libs -L/root/go/deps/cowsql/.libs/" && \
export LD_LIBRARY_PATH="/root/go/deps/raft/.libs/:/root/go/deps/cowsql/.libs/" && \
export CGO_LDFLAGS_ALLOW="(-Wl,-wrap,pthread_create)|(-Wl,-z,now)" && \
make build
# Default command to build RPMs
CMD /app/scripts/build-packages.sh
CMD /app/resources/build.sh
+52
View File
@@ -0,0 +1,52 @@
#!/usr/bin/bash
# Install build dependencies
dnf install -y \
unzip \
libtool \
autoconf \
automake \
gcc \
make \
git \
go \
cowsql-devel \
libacl-devel \
libcap-devel \
libseccomp-devel \
libuv-devel \
raft-devel \
libudev-devel \
lxc-devel \
libsqlite3x-devel \
sqlite-devel \
systemd-rpm-macros \
bash-completion \
gettext \
help2man \
wget
# Download and extract incus source
wget -O /app/incus.tar.gz https://github.com/lxc/incus/archive/refs/tags/v${PACKAGE_VERSION}.tar.gz
tar -C /app -xf incus.tar.gz
# Install specific Go version
wget https://go.dev/dl/go1.24.1.linux-amd64.tar.gz
rm -rf /usr/local/go
tar -C /usr/local -xzf go1.24.1.linux-amd64.tar.gz
# Set up Go environment and build incus
export PATH=/usr/local/go/bin:$PATH
pushd /app/incus-${PACKAGE_VERSION}
make deps
export CGO_CFLAGS="-I/root/go/deps/raft/include/ -I/root/go/deps/cowsql/include/"
export CGO_LDFLAGS="-L/root/go/deps/raft/.libs -L/root/go/deps/cowsql/.libs/"
export LD_LIBRARY_PATH="/root/go/deps/raft/.libs/:/root/go/deps/cowsql/.libs/"
export CGO_LDFLAGS_ALLOW="(-Wl,-wrap,pthread_create)|(-Wl,-z,now)"
make build
popd
# Build the RPMs
nfpm pkg --config /app/resources/nfpm_incus.yaml --target /app/dist --packager rpm
nfpm pkg --config /app/resources/nfpm_incus-client.yaml --target /app/dist --packager rpm
nfpm pkg --config /app/resources/nfpm_incus-tools.yaml --target /app/dist --packager rpm
-4
View File
@@ -1,4 +0,0 @@
#!/usr/bin/bash
nfpm pkg --config /app/resources/nfpm_incus.yaml --target /app/dist --packager rpm && \
nfpm pkg --config /app/resources/nfpm_incus-client.yaml --target /app/dist --packager rpm && \
nfpm pkg --config /app/resources/nfpm_incus-tools.yaml --target /app/dist --packager rpm