mirror of
https://github.com/lukaszraczylo/gohoarder.git
synced 2026-07-22 06:20:09 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
af5e08a864 | ||
|
|
adc7388ee1 | ||
|
|
116ba9b006 | ||
|
|
03860dcb49 | ||
|
|
a1ec05b210 | ||
|
|
dc1d507a20 | ||
|
|
72f284f987 | ||
|
|
ef11972274 | ||
|
|
96f9f4a36c | ||
|
|
311e4d13f6 | ||
|
|
f936dfa359 | ||
|
|
c1103630f0 |
@@ -20,10 +20,9 @@ permissions:
|
||||
|
||||
jobs:
|
||||
release:
|
||||
uses: lukaszraczylo/shared-actions/.github/workflows/go-release.yaml@main
|
||||
uses: lukaszraczylo/shared-actions/.github/workflows/go-release-cgo.yaml@main
|
||||
with:
|
||||
go-version: "1.25"
|
||||
docker-enabled: true
|
||||
secrets: inherit
|
||||
|
||||
benchmark:
|
||||
|
||||
+66
-41
@@ -13,42 +13,60 @@ before:
|
||||
# - ./script/generate-version.sh
|
||||
|
||||
# Build configuration
|
||||
# Builds run natively per-platform in split mode (no CGO cross-compilation)
|
||||
# Docker images also use multi-stage builds independently
|
||||
builds:
|
||||
- id: gohoarder
|
||||
main: ./cmd/gohoarder
|
||||
binary: gohoarder
|
||||
env:
|
||||
- CGO_ENABLED=0
|
||||
goos:
|
||||
- linux
|
||||
- darwin
|
||||
- windows
|
||||
goarch:
|
||||
- amd64
|
||||
- arm64
|
||||
- CGO_ENABLED=1
|
||||
tags:
|
||||
- fts5
|
||||
flags:
|
||||
- -trimpath
|
||||
ldflags:
|
||||
- -s -w
|
||||
- -X github.com/lukaszraczylo/gohoarder/internal/version.Version={{.Version}}
|
||||
- -X github.com/lukaszraczylo/gohoarder/internal/version.GitCommit={{.ShortCommit}}
|
||||
- -X github.com/lukaszraczylo/gohoarder/internal/version.BuildTime={{.Date}}
|
||||
goos:
|
||||
- linux
|
||||
- darwin
|
||||
goarch:
|
||||
- amd64
|
||||
- arm64
|
||||
ignore:
|
||||
- goos: darwin
|
||||
goarch: amd64
|
||||
- goos: linux
|
||||
goarch: arm64 # Skip linux/arm64 binaries (Docker handles multi-arch)
|
||||
|
||||
- id: migrate
|
||||
main: ./cmd/migrate
|
||||
binary: migrate
|
||||
env:
|
||||
- CGO_ENABLED=0
|
||||
goos:
|
||||
- linux
|
||||
- darwin
|
||||
- windows
|
||||
goarch:
|
||||
- amd64
|
||||
- arm64
|
||||
- CGO_ENABLED=1
|
||||
tags:
|
||||
- fts5
|
||||
flags:
|
||||
- -trimpath
|
||||
ldflags:
|
||||
- -s -w
|
||||
- -X main.Version={{.Version}}
|
||||
- -X main.GitCommit={{.ShortCommit}}
|
||||
- -X main.BuildTime={{.Date}}
|
||||
goos:
|
||||
- linux
|
||||
- darwin
|
||||
goarch:
|
||||
- amd64
|
||||
- arm64
|
||||
ignore:
|
||||
- goos: darwin
|
||||
goarch: amd64
|
||||
- goos: linux
|
||||
goarch: arm64 # Skip linux/arm64 binaries (Docker handles multi-arch)
|
||||
|
||||
# Archives for releases
|
||||
archives:
|
||||
@@ -108,17 +126,20 @@ release:
|
||||
dockers_v2:
|
||||
# 1. Application Engine - Main GoHoarder server
|
||||
- id: gohoarder-server
|
||||
ids:
|
||||
- gohoarder
|
||||
images:
|
||||
- ghcr.io/lukaszraczylo/gohoarder-server
|
||||
tags:
|
||||
- "{{ .Version }}"
|
||||
- latest
|
||||
platforms:
|
||||
- linux/amd64
|
||||
- linux/arm64
|
||||
build_args:
|
||||
VERSION: "{{ .Version }}"
|
||||
GIT_COMMIT: "{{ .ShortCommit }}"
|
||||
BUILD_TIME: "{{ .Date }}"
|
||||
tags:
|
||||
- "{{ .Version }}"
|
||||
- latest
|
||||
dockerfile: Dockerfile.server
|
||||
sbom: false # Disable SBOM attestations (requires docker-container driver)
|
||||
labels:
|
||||
org.opencontainers.image.title: GoHoarder Server
|
||||
org.opencontainers.image.description: Universal package cache proxy server
|
||||
@@ -132,17 +153,16 @@ dockers_v2:
|
||||
|
||||
# 2. Website - Frontend Dashboard
|
||||
- id: gohoarder-frontend
|
||||
ids:
|
||||
- gohoarder
|
||||
images:
|
||||
- ghcr.io/lukaszraczylo/gohoarder-frontend
|
||||
tags:
|
||||
- "{{ .Version }}"
|
||||
- latest
|
||||
platforms:
|
||||
- linux/amd64
|
||||
- linux/arm64
|
||||
tags:
|
||||
- "{{ .Version }}"
|
||||
- latest
|
||||
dockerfile: Dockerfile.frontend
|
||||
sbom: false # Disable SBOM attestations (requires docker-container driver)
|
||||
labels:
|
||||
org.opencontainers.image.title: GoHoarder Frontend
|
||||
org.opencontainers.image.description: GoHoarder web dashboard
|
||||
@@ -156,17 +176,20 @@ dockers_v2:
|
||||
|
||||
# 3. Scanning Engine - Background scanner worker
|
||||
- id: gohoarder-scanner
|
||||
ids:
|
||||
- gohoarder
|
||||
images:
|
||||
- ghcr.io/lukaszraczylo/gohoarder-scanner
|
||||
tags:
|
||||
- "{{ .Version }}"
|
||||
- latest
|
||||
platforms:
|
||||
- linux/amd64
|
||||
- linux/arm64
|
||||
build_args:
|
||||
VERSION: "{{ .Version }}"
|
||||
GIT_COMMIT: "{{ .ShortCommit }}"
|
||||
BUILD_TIME: "{{ .Date }}"
|
||||
tags:
|
||||
- "{{ .Version }}"
|
||||
- latest
|
||||
dockerfile: Dockerfile.scanner
|
||||
sbom: false # Disable SBOM attestations (requires docker-container driver)
|
||||
labels:
|
||||
org.opencontainers.image.title: GoHoarder Scanner
|
||||
org.opencontainers.image.description: GoHoarder vulnerability scanning engine
|
||||
@@ -180,17 +203,16 @@ dockers_v2:
|
||||
|
||||
# 4. Gateway - Nginx reverse proxy for unified deployment
|
||||
- id: gohoarder-gateway
|
||||
ids:
|
||||
- gohoarder
|
||||
images:
|
||||
- ghcr.io/lukaszraczylo/gohoarder-gateway
|
||||
tags:
|
||||
- "{{ .Version }}"
|
||||
- latest
|
||||
platforms:
|
||||
- linux/amd64
|
||||
- linux/arm64
|
||||
tags:
|
||||
- "{{ .Version }}"
|
||||
- latest
|
||||
dockerfile: Dockerfile.gateway
|
||||
sbom: false # Disable SBOM attestations (requires docker-container driver)
|
||||
labels:
|
||||
org.opencontainers.image.title: GoHoarder Gateway
|
||||
org.opencontainers.image.description: Nginx reverse proxy for unified GoHoarder deployment
|
||||
@@ -202,17 +224,20 @@ dockers_v2:
|
||||
|
||||
# 5. Migration Engine - Database migration tool
|
||||
- id: gohoarder-migrate
|
||||
ids:
|
||||
- migrate
|
||||
images:
|
||||
- ghcr.io/lukaszraczylo/gohoarder-migrate
|
||||
tags:
|
||||
- "{{ .Version }}"
|
||||
- latest
|
||||
platforms:
|
||||
- linux/amd64
|
||||
- linux/arm64
|
||||
build_args:
|
||||
VERSION: "{{ .Version }}"
|
||||
GIT_COMMIT: "{{ .ShortCommit }}"
|
||||
BUILD_TIME: "{{ .Date }}"
|
||||
tags:
|
||||
- "{{ .Version }}"
|
||||
- latest
|
||||
dockerfile: Dockerfile.migrate
|
||||
sbom: false # Disable SBOM attestations (requires docker-container driver)
|
||||
labels:
|
||||
org.opencontainers.image.title: GoHoarder Migrate
|
||||
org.opencontainers.image.description: Database migration tool for GoHoarder V2 schema
|
||||
|
||||
+41
-5
@@ -1,25 +1,61 @@
|
||||
# Migration Engine - Database Migration Tool
|
||||
# Multi-stage build to compile with CGO support
|
||||
ARG TARGETOS=linux
|
||||
ARG TARGETARCH=amd64
|
||||
|
||||
# Build stage
|
||||
FROM --platform=$TARGETOS/$TARGETARCH golang:1.23-alpine AS builder
|
||||
|
||||
# Install build dependencies for CGO
|
||||
RUN apk add --no-cache \
|
||||
gcc \
|
||||
g++ \
|
||||
musl-dev \
|
||||
sqlite-dev \
|
||||
git
|
||||
|
||||
WORKDIR /build
|
||||
|
||||
# Copy go mod files
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
|
||||
# Copy source code
|
||||
COPY . .
|
||||
|
||||
# Build with CGO enabled
|
||||
ARG TARGETOS
|
||||
ARG TARGETARCH
|
||||
ARG VERSION=dev
|
||||
ARG GIT_COMMIT=unknown
|
||||
ARG BUILD_TIME=unknown
|
||||
|
||||
RUN CGO_ENABLED=1 GOOS=$TARGETOS GOARCH=$TARGETARCH \
|
||||
go build -ldflags="-s -w \
|
||||
-X main.Version=${VERSION} \
|
||||
-X main.GitCommit=${GIT_COMMIT} \
|
||||
-X main.BuildTime=${BUILD_TIME}" \
|
||||
-o migrate ./cmd/migrate
|
||||
|
||||
# Runtime stage
|
||||
FROM alpine:latest
|
||||
|
||||
# Install runtime dependencies
|
||||
# Install runtime dependencies (including CGO/SQLite dependencies)
|
||||
RUN apk add --no-cache \
|
||||
ca-certificates \
|
||||
postgresql-client \
|
||||
mysql-client \
|
||||
busybox-extras \
|
||||
sqlite-libs \
|
||||
musl \
|
||||
&& update-ca-certificates
|
||||
|
||||
# Create non-root user
|
||||
RUN addgroup -g 1000 gohoarder && \
|
||||
adduser -D -u 1000 -G gohoarder gohoarder
|
||||
|
||||
# Copy binary (from platform-specific path)
|
||||
ARG TARGETOS
|
||||
ARG TARGETARCH
|
||||
COPY ${TARGETOS}/${TARGETARCH}/migrate /usr/local/bin/migrate
|
||||
# Copy binary from builder
|
||||
COPY --from=builder /build/migrate /usr/local/bin/migrate
|
||||
RUN chmod +x /usr/local/bin/migrate
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
+41
-5
@@ -1,10 +1,46 @@
|
||||
# Scanning Engine - Background Scanner Worker
|
||||
# Multi-stage build to compile with CGO support
|
||||
ARG TARGETOS=linux
|
||||
ARG TARGETARCH=amd64
|
||||
|
||||
# Build stage
|
||||
FROM --platform=$TARGETOS/$TARGETARCH golang:1.23-alpine AS builder
|
||||
|
||||
# Install build dependencies for CGO
|
||||
RUN apk add --no-cache \
|
||||
gcc \
|
||||
g++ \
|
||||
musl-dev \
|
||||
sqlite-dev \
|
||||
git
|
||||
|
||||
WORKDIR /build
|
||||
|
||||
# Copy go mod files
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
|
||||
# Copy source code
|
||||
COPY . .
|
||||
|
||||
# Build with CGO enabled
|
||||
ARG TARGETOS
|
||||
ARG TARGETARCH
|
||||
ARG VERSION=dev
|
||||
ARG GIT_COMMIT=unknown
|
||||
ARG BUILD_TIME=unknown
|
||||
|
||||
RUN CGO_ENABLED=1 GOOS=$TARGETOS GOARCH=$TARGETARCH \
|
||||
go build -ldflags="-s -w \
|
||||
-X github.com/lukaszraczylo/gohoarder/internal/version.Version=${VERSION} \
|
||||
-X github.com/lukaszraczylo/gohoarder/internal/version.GitCommit=${GIT_COMMIT} \
|
||||
-X github.com/lukaszraczylo/gohoarder/internal/version.BuildTime=${BUILD_TIME}" \
|
||||
-o gohoarder ./cmd/gohoarder
|
||||
|
||||
# Runtime stage
|
||||
FROM alpine:latest
|
||||
|
||||
# Install scanning tools and runtime dependencies
|
||||
# Install scanning tools and runtime dependencies (including CGO/SQLite dependencies)
|
||||
RUN apk add --no-cache \
|
||||
ca-certificates \
|
||||
tzdata \
|
||||
@@ -12,6 +48,8 @@ RUN apk add --no-cache \
|
||||
curl \
|
||||
wget \
|
||||
bash \
|
||||
sqlite-libs \
|
||||
musl \
|
||||
&& update-ca-certificates
|
||||
|
||||
# Install Trivy for container scanning
|
||||
@@ -37,10 +75,8 @@ RUN mkdir -p /var/cache/gohoarder \
|
||||
/var/lib/gohoarder \
|
||||
/var/lib/trivy
|
||||
|
||||
# Copy binary (from platform-specific path)
|
||||
ARG TARGETOS
|
||||
ARG TARGETARCH
|
||||
COPY ${TARGETOS}/${TARGETARCH}/gohoarder /usr/local/bin/gohoarder
|
||||
# Copy binary from builder
|
||||
COPY --from=builder /build/gohoarder /usr/local/bin/gohoarder
|
||||
RUN chmod +x /usr/local/bin/gohoarder
|
||||
|
||||
# Copy example config
|
||||
|
||||
+41
-5
@@ -1,13 +1,51 @@
|
||||
# Application Engine - GoHoarder Server
|
||||
# Multi-stage build to compile with CGO support
|
||||
ARG TARGETOS=linux
|
||||
ARG TARGETARCH=amd64
|
||||
|
||||
# Build stage
|
||||
FROM --platform=$TARGETOS/$TARGETARCH golang:1.23-alpine AS builder
|
||||
|
||||
# Install build dependencies for CGO
|
||||
RUN apk add --no-cache \
|
||||
gcc \
|
||||
g++ \
|
||||
musl-dev \
|
||||
sqlite-dev \
|
||||
git
|
||||
|
||||
WORKDIR /build
|
||||
|
||||
# Copy go mod files
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
|
||||
# Copy source code
|
||||
COPY . .
|
||||
|
||||
# Build with CGO enabled
|
||||
ARG TARGETOS
|
||||
ARG TARGETARCH
|
||||
ARG VERSION=dev
|
||||
ARG GIT_COMMIT=unknown
|
||||
ARG BUILD_TIME=unknown
|
||||
|
||||
RUN CGO_ENABLED=1 GOOS=$TARGETOS GOARCH=$TARGETARCH \
|
||||
go build -ldflags="-s -w \
|
||||
-X github.com/lukaszraczylo/gohoarder/internal/version.Version=${VERSION} \
|
||||
-X github.com/lukaszraczylo/gohoarder/internal/version.GitCommit=${GIT_COMMIT} \
|
||||
-X github.com/lukaszraczylo/gohoarder/internal/version.BuildTime=${BUILD_TIME}" \
|
||||
-o gohoarder ./cmd/gohoarder
|
||||
|
||||
# Runtime stage
|
||||
FROM alpine:latest
|
||||
|
||||
# Install runtime dependencies
|
||||
# Install runtime dependencies (including CGO/SQLite dependencies)
|
||||
RUN apk add --no-cache \
|
||||
ca-certificates \
|
||||
tzdata \
|
||||
sqlite-libs \
|
||||
musl \
|
||||
&& update-ca-certificates
|
||||
|
||||
# Create non-root user
|
||||
@@ -24,10 +62,8 @@ RUN mkdir -p /var/cache/gohoarder \
|
||||
chmod -R 750 /var/cache/gohoarder \
|
||||
/var/lib/gohoarder
|
||||
|
||||
# Copy binary (from platform-specific path)
|
||||
ARG TARGETOS
|
||||
ARG TARGETARCH
|
||||
COPY ${TARGETOS}/${TARGETARCH}/gohoarder /usr/local/bin/gohoarder
|
||||
# Copy binary from builder
|
||||
COPY --from=builder /build/gohoarder /usr/local/bin/gohoarder
|
||||
RUN chmod +x /usr/local/bin/gohoarder
|
||||
|
||||
# Copy example config
|
||||
|
||||
Executable
+78
@@ -0,0 +1,78 @@
|
||||
#!/bin/bash
|
||||
# Workflow prepare script for CI/CD
|
||||
# Installs CGO dependencies for SQLite support
|
||||
|
||||
set -e
|
||||
|
||||
echo "=== GoHoarder Workflow Prepare ==="
|
||||
echo "Host OS: $(uname -s)"
|
||||
echo "Target GOOS: ${TARGET_GOOS:-auto}"
|
||||
echo "Target GOARCH: ${TARGET_GOARCH:-auto}"
|
||||
|
||||
# Detect host OS
|
||||
HOST_OS=$(uname -s | tr '[:upper:]' '[:lower:]')
|
||||
|
||||
# Install SQLite development headers based on platform
|
||||
case "$HOST_OS" in
|
||||
linux*)
|
||||
echo "Installing SQLite development headers for Linux..."
|
||||
if command -v apt-get &> /dev/null; then
|
||||
# Ubuntu/Debian
|
||||
sudo apt-get update -qq
|
||||
sudo apt-get install -y -qq libsqlite3-dev
|
||||
elif command -v yum &> /dev/null; then
|
||||
# RHEL/CentOS
|
||||
sudo yum install -y sqlite-devel
|
||||
elif command -v apk &> /dev/null; then
|
||||
# Alpine
|
||||
sudo apk add --no-cache sqlite-dev
|
||||
fi
|
||||
echo "✓ SQLite headers installed"
|
||||
;;
|
||||
|
||||
darwin*)
|
||||
echo "Installing SQLite for macOS..."
|
||||
# macOS usually has SQLite via Xcode Command Line Tools
|
||||
# but ensure it's available via Homebrew if needed
|
||||
if ! pkg-config --exists sqlite3; then
|
||||
brew install sqlite3
|
||||
fi
|
||||
echo "✓ SQLite available"
|
||||
;;
|
||||
|
||||
mingw*|msys*|cygwin*)
|
||||
echo "Installing SQLite for Windows..."
|
||||
# Download SQLite amalgamation for Windows
|
||||
SQLITE_VERSION="3470200"
|
||||
SQLITE_YEAR="2024"
|
||||
SQLITE_DIR="/c/sqlite"
|
||||
SQLITE_URL="https://www.sqlite.org/${SQLITE_YEAR}/sqlite-amalgamation-${SQLITE_VERSION}.zip"
|
||||
|
||||
mkdir -p "$SQLITE_DIR"
|
||||
curl -sSL "$SQLITE_URL" -o /tmp/sqlite.zip
|
||||
unzip -q /tmp/sqlite.zip -d /tmp/
|
||||
cp /tmp/sqlite-amalgamation-${SQLITE_VERSION}/* "$SQLITE_DIR/"
|
||||
rm -rf /tmp/sqlite.zip /tmp/sqlite-amalgamation-${SQLITE_VERSION}
|
||||
|
||||
echo "CGO_CFLAGS=-I${SQLITE_DIR}" >> "$GITHUB_ENV"
|
||||
echo "CGO_LDFLAGS=-L${SQLITE_DIR}" >> "$GITHUB_ENV"
|
||||
echo "✓ SQLite setup complete"
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Unknown OS: $HOST_OS - skipping SQLite setup"
|
||||
;;
|
||||
esac
|
||||
|
||||
# Verify SQLite is available
|
||||
echo ""
|
||||
echo "=== Verifying SQLite availability ==="
|
||||
if pkg-config --exists sqlite3; then
|
||||
echo "✓ SQLite pkg-config found"
|
||||
pkg-config --modversion sqlite3
|
||||
else
|
||||
echo "⚠ SQLite pkg-config not found (may still work via system headers)"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "=== Workflow prepare complete ==="
|
||||
Reference in New Issue
Block a user