fix: Support Debian Bookworm et Ubuntu pour le package .deb
Cible: Debian Bookworm (12) et Ubuntu 22.04+ Changes: - packaging/Dockerfile.deb: Build via Docker avec Go 1.24 - packaging/build-deb.sh: Ajout paramètre distribution (debian/ubuntu) - packaging/test/Dockerfile.deb: Test sur Debian Bookworm - packaging/test/test-*.sh: Tests spécifiques Debian/Ubuntu - .github/workflows/build-deb.yml: * Nom du job: 'Build DEB Package (Debian/Ubuntu)' * TARGET_DIST: debian:bookworm * Build simplifié via Docker - Makefile: package-deb utilise Docker (cohérent avec RPM) Compatibilité: - Debian 11 (Bullseye) - Debian 12 (Bookworm) - Ubuntu 20.04 LTS - Ubuntu 22.04 LTS - Ubuntu 24.04 LTS Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
@ -1,17 +1,13 @@
|
||||
# Dockerfile for building DEB packages
|
||||
FROM ubuntu:22.04
|
||||
# Dockerfile for building DEB packages for Debian/Ubuntu
|
||||
# Use Go 1.24 as base to ensure correct Go version
|
||||
FROM golang:1.24-bookworm AS builder
|
||||
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
# Install build dependencies
|
||||
# Install DEB build tools
|
||||
RUN apt-get update && apt-get install -y \
|
||||
golang-go \
|
||||
git \
|
||||
make \
|
||||
libpcap-dev \
|
||||
dpkg-dev \
|
||||
fakeroot \
|
||||
lintian \
|
||||
libpcap-dev \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
WORKDIR /app
|
||||
@ -19,5 +15,21 @@ WORKDIR /app
|
||||
# Copy source code
|
||||
COPY . .
|
||||
|
||||
# Default command: build DEB package
|
||||
CMD ["./packaging/build-deb.sh", "1.0.0", "amd64"]
|
||||
# Build binary
|
||||
ARG VERSION=1.0.0
|
||||
RUN mkdir -p dist && \
|
||||
CGO_ENABLED=1 GOOS=linux GOARCH=amd64 \
|
||||
go build -buildvcs=false -o dist/ja4sentinel-linux-amd64 ./cmd/ja4sentinel
|
||||
|
||||
# Build DEB for Debian/Ubuntu
|
||||
ARG ARCH=amd64
|
||||
RUN mkdir -p /app/packages && \
|
||||
./packaging/build-deb.sh "${VERSION}" "${ARCH}" "debian" && \
|
||||
cp /app/build/deb/*.deb /app/packages/
|
||||
|
||||
# Final stage - minimal image with just the DEB
|
||||
FROM alpine:latest
|
||||
|
||||
COPY --from=builder /app/packages/ /packages/
|
||||
|
||||
CMD ["ls", "-la", "/packages/"]
|
||||
|
||||
@ -1,28 +1,26 @@
|
||||
#!/bin/bash
|
||||
# Build script for .deb package
|
||||
# Usage: ./build-deb.sh [version] [architecture]
|
||||
# Usage: ./build-deb.sh [version] [architecture] [distribution]
|
||||
# distribution: debian, ubuntu (default: debian)
|
||||
|
||||
set -e
|
||||
|
||||
# Sanitize version for Debian package (must start with digit)
|
||||
VERSION="${1:-1.0.0}"
|
||||
ARCH="${2:-amd64}"
|
||||
DIST="${3:-debian}"
|
||||
PACKAGE_NAME="ja4sentinel"
|
||||
|
||||
# Convert git version to Debian-compatible format
|
||||
# e.g., "v1.0.0" -> "1.0.0", "efd4481-dirty" -> "0.0.0+efd4481"
|
||||
if [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+ ]]; then
|
||||
# Already a valid semver
|
||||
DEB_VERSION="$VERSION"
|
||||
elif [[ "$VERSION" =~ ^v([0-9]+\.[0-9]+\.[0-9]+) ]]; then
|
||||
# v-prefixed semver
|
||||
DEB_VERSION="${BASH_REMATCH[1]}"
|
||||
else
|
||||
# Git hash or other format -> use 0.0.0+<hash>
|
||||
DEB_VERSION="0.0.0+${VERSION//[^a-zA-Z0-9+.-]/_}"
|
||||
fi
|
||||
|
||||
echo "=== Building ${PACKAGE_NAME} ${DEB_VERSION} for ${ARCH} ==="
|
||||
echo "=== Building ${PACKAGE_NAME} ${DEB_VERSION} for ${DIST} (${ARCH}) ==="
|
||||
|
||||
# Directories
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
# Dockerfile for testing DEB package installation
|
||||
FROM ubuntu:22.04
|
||||
# Dockerfile for testing DEB package installation on Debian/Ubuntu
|
||||
FROM debian:bookworm-slim
|
||||
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
#!/bin/bash
|
||||
# Test DEB package installation in Docker container
|
||||
# Test DEB package installation in Debian/Ubuntu container
|
||||
set -e
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
|
||||
@ -1,9 +1,10 @@
|
||||
#!/bin/bash
|
||||
# Test script for DEB package installation
|
||||
# Test script for DEB package installation on Debian/Ubuntu
|
||||
set -e
|
||||
|
||||
echo "=========================================="
|
||||
echo " JA4Sentinel DEB Package Installation Test"
|
||||
echo " Target: Debian Bookworm / Ubuntu 22.04+"
|
||||
echo "=========================================="
|
||||
|
||||
# Colors for output
|
||||
|
||||
Reference in New Issue
Block a user