Some checks failed
Build RPM Package / Build RPM Packages (CentOS 7, Rocky 8/9/10) (push) Has been cancelled
- Suppression complète du support DEB (Debian/Ubuntu) - Builder Rocky Linux 9 pour compatibilité binaire maximale - Compilation dynamique avec libpcap comme dépendance runtime - Activation du dépôt CRB pour libpcap-devel - RPM générés pour el7, el8, el9, el10 - Mise à jour documentation et workflows GitHub Actions Fix: erreur 'libpcap.so.0.8: cannot open shared object file' sur Rocky Linux 9 Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
66 lines
1.5 KiB
Docker
66 lines
1.5 KiB
Docker
# Production runtime image for ja4sentinel
|
|
# Based on architecture.yml ci_cd.docker.images.ja4sentinel-runtime
|
|
|
|
# Build stage
|
|
FROM golang:1.24-alpine AS builder
|
|
|
|
# Install build dependencies
|
|
RUN apk add --no-cache \
|
|
git \
|
|
make \
|
|
libpcap-dev \
|
|
gcc \
|
|
musl-dev \
|
|
linux-headers
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy go mod files
|
|
COPY go.mod go.sum* ./
|
|
|
|
# Download dependencies
|
|
RUN go mod download || true
|
|
|
|
# Copy source code
|
|
COPY . .
|
|
|
|
# Build binary with static libpcap linking
|
|
ARG VERSION=dev
|
|
ARG BUILD_TIME=unknown
|
|
ARG GIT_COMMIT=unknown
|
|
|
|
RUN mkdir -p dist && \
|
|
CGO_ENABLED=1 GOOS=linux GOARCH=amd64 \
|
|
CGO_LDFLAGS="-Wl,-Bstatic -lpcap -Wl,-Bdynamic" \
|
|
go build -buildvcs=false \
|
|
-ldflags "-X main.Version=${VERSION} -X main.BuildTime=${BUILD_TIME} -X main.GitCommit=${GIT_COMMIT}" \
|
|
-o dist/ja4sentinel ./cmd/ja4sentinel
|
|
|
|
# Runtime stage
|
|
FROM alpine:latest
|
|
|
|
# Install runtime dependencies (no libpcap needed - statically linked)
|
|
RUN apk add --no-cache \
|
|
ca-certificates
|
|
|
|
# Create non-root user for security
|
|
RUN addgroup -S ja4sentinel && adduser -S ja4sentinel -G ja4sentinel
|
|
|
|
# Create necessary directories
|
|
RUN mkdir -p /var/lib/ja4sentinel /var/run /etc/ja4sentinel /var/log/ja4sentinel
|
|
|
|
# Copy binary from build stage
|
|
COPY --from=builder /app/dist/ja4sentinel /usr/local/bin/ja4sentinel
|
|
|
|
# Set ownership
|
|
RUN chown -R ja4sentinel:ja4sentinel /var/lib/ja4sentinel /var/log/ja4sentinel
|
|
|
|
# Switch to non-root user
|
|
USER ja4sentinel
|
|
|
|
# Working directory
|
|
WORKDIR /var/lib/ja4sentinel
|
|
|
|
# Default command
|
|
ENTRYPOINT ["/usr/local/bin/ja4sentinel"]
|