mirror of
https://github.com/lukaszraczylo/gohoarder.git
synced 2026-07-22 06:20:09 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ae632a3dd7 | ||
|
|
c212077478 | ||
|
|
af5e08a864 | ||
|
|
adc7388ee1 | ||
|
|
116ba9b006 | ||
|
|
03860dcb49 | ||
|
|
a1ec05b210 | ||
|
|
dc1d507a20 | ||
|
|
72f284f987 | ||
|
|
ef11972274 | ||
|
|
96f9f4a36c |
@@ -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:
|
||||
|
||||
+142
-72
@@ -7,19 +7,62 @@ project_name: gohoarder
|
||||
before:
|
||||
hooks:
|
||||
- go mod tidy
|
||||
# Generate semantic version if not provided via git tag
|
||||
# This script can be used by CI/CD to inject custom versions
|
||||
# Usage: export GORELEASER_CURRENT_TAG=$(./script/generate-version.sh)
|
||||
# - ./script/generate-version.sh
|
||||
|
||||
# Build configuration
|
||||
# Note: Binaries are built inside Docker containers (multi-stage builds)
|
||||
# to avoid CGO cross-compilation issues. No standalone builds here.
|
||||
# Binary builds for direct downloads (darwin/arm64, linux/amd64)
|
||||
# Binaries use split mode to avoid CGO cross-compilation
|
||||
builds:
|
||||
- id: gohoarder
|
||||
skip: true
|
||||
main: ./cmd/gohoarder
|
||||
binary: gohoarder
|
||||
env:
|
||||
- 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
|
||||
skip: true
|
||||
main: ./cmd/migrate
|
||||
binary: migrate
|
||||
env:
|
||||
- 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:
|
||||
@@ -76,121 +119,148 @@ release:
|
||||
prerelease: auto
|
||||
|
||||
# Docker images (v2 - modern syntax)
|
||||
# All Dockerfiles are self-contained multi-stage builds
|
||||
# GoReleaser orchestrates buildx and passes build args
|
||||
dockers_v2:
|
||||
# 1. Application Engine - Main GoHoarder server
|
||||
- id: gohoarder-server
|
||||
use: buildx
|
||||
images:
|
||||
- ghcr.io/lukaszraczylo/gohoarder-server
|
||||
build_flag_templates:
|
||||
- "--platform=linux/amd64,linux/arm64"
|
||||
- "--build-arg=VERSION={{ .Version }}"
|
||||
- "--build-arg=GIT_COMMIT={{ .ShortCommit }}"
|
||||
- "--build-arg=BUILD_TIME={{ .Date }}"
|
||||
tags:
|
||||
- "{{ .Version }}"
|
||||
- latest
|
||||
platforms:
|
||||
- linux/amd64
|
||||
- linux/arm64
|
||||
dockerfile: Dockerfile.server
|
||||
labels:
|
||||
org.opencontainers.image.title: GoHoarder Server
|
||||
org.opencontainers.image.description: Universal package cache proxy server
|
||||
org.opencontainers.image.url: https://github.com/lukaszraczylo/gohoarder
|
||||
org.opencontainers.image.source: https://github.com/lukaszraczylo/gohoarder
|
||||
org.opencontainers.image.version: "{{ .Version }}"
|
||||
org.opencontainers.image.created: "{{ .Date }}"
|
||||
org.opencontainers.image.revision: "{{ .FullCommit }}"
|
||||
build_args:
|
||||
VERSION: "{{ .Version }}"
|
||||
GIT_COMMIT: "{{ .ShortCommit }}"
|
||||
BUILD_TIME: "{{ .Date }}"
|
||||
flags:
|
||||
- "--pull"
|
||||
- "--label=org.opencontainers.image.title=GoHoarder Server"
|
||||
- "--label=org.opencontainers.image.description=Universal package cache proxy server"
|
||||
- "--label=org.opencontainers.image.url=https://github.com/lukaszraczylo/gohoarder"
|
||||
- "--label=org.opencontainers.image.source=https://github.com/lukaszraczylo/gohoarder"
|
||||
- "--label=org.opencontainers.image.version={{ .Version }}"
|
||||
- "--label=org.opencontainers.image.created={{ .Date }}"
|
||||
- "--label=org.opencontainers.image.revision={{ .FullCommit }}"
|
||||
extra_files:
|
||||
- go.mod
|
||||
- go.sum
|
||||
- cmd
|
||||
- pkg
|
||||
- internal
|
||||
- config.yaml.example
|
||||
|
||||
# 2. Website - Frontend Dashboard
|
||||
- id: gohoarder-frontend
|
||||
use: buildx
|
||||
images:
|
||||
- ghcr.io/lukaszraczylo/gohoarder-frontend
|
||||
build_flag_templates:
|
||||
- "--platform=linux/amd64,linux/arm64"
|
||||
tags:
|
||||
- "{{ .Version }}"
|
||||
- latest
|
||||
platforms:
|
||||
- linux/amd64
|
||||
- linux/arm64
|
||||
dockerfile: Dockerfile.frontend
|
||||
labels:
|
||||
org.opencontainers.image.title: GoHoarder Frontend
|
||||
org.opencontainers.image.description: GoHoarder web dashboard
|
||||
org.opencontainers.image.url: https://github.com/lukaszraczylo/gohoarder
|
||||
org.opencontainers.image.source: https://github.com/lukaszraczylo/gohoarder
|
||||
org.opencontainers.image.version: "{{ .Version }}"
|
||||
org.opencontainers.image.created: "{{ .Date }}"
|
||||
org.opencontainers.image.revision: "{{ .FullCommit }}"
|
||||
flags:
|
||||
- "--pull"
|
||||
- "--label=org.opencontainers.image.title=GoHoarder Frontend"
|
||||
- "--label=org.opencontainers.image.description=GoHoarder web dashboard"
|
||||
- "--label=org.opencontainers.image.url=https://github.com/lukaszraczylo/gohoarder"
|
||||
- "--label=org.opencontainers.image.source=https://github.com/lukaszraczylo/gohoarder"
|
||||
- "--label=org.opencontainers.image.version={{ .Version }}"
|
||||
- "--label=org.opencontainers.image.created={{ .Date }}"
|
||||
- "--label=org.opencontainers.image.revision={{ .FullCommit }}"
|
||||
extra_files:
|
||||
- frontend
|
||||
|
||||
# 3. Scanning Engine - Background scanner worker
|
||||
- id: gohoarder-scanner
|
||||
use: buildx
|
||||
images:
|
||||
- ghcr.io/lukaszraczylo/gohoarder-scanner
|
||||
build_flag_templates:
|
||||
- "--platform=linux/amd64,linux/arm64"
|
||||
- "--build-arg=VERSION={{ .Version }}"
|
||||
- "--build-arg=GIT_COMMIT={{ .ShortCommit }}"
|
||||
- "--build-arg=BUILD_TIME={{ .Date }}"
|
||||
tags:
|
||||
- "{{ .Version }}"
|
||||
- latest
|
||||
platforms:
|
||||
- linux/amd64
|
||||
- linux/arm64
|
||||
dockerfile: Dockerfile.scanner
|
||||
labels:
|
||||
org.opencontainers.image.title: GoHoarder Scanner
|
||||
org.opencontainers.image.description: GoHoarder vulnerability scanning engine
|
||||
org.opencontainers.image.url: https://github.com/lukaszraczylo/gohoarder
|
||||
org.opencontainers.image.source: https://github.com/lukaszraczylo/gohoarder
|
||||
org.opencontainers.image.version: "{{ .Version }}"
|
||||
org.opencontainers.image.created: "{{ .Date }}"
|
||||
org.opencontainers.image.revision: "{{ .FullCommit }}"
|
||||
build_args:
|
||||
VERSION: "{{ .Version }}"
|
||||
GIT_COMMIT: "{{ .ShortCommit }}"
|
||||
BUILD_TIME: "{{ .Date }}"
|
||||
flags:
|
||||
- "--pull"
|
||||
- "--label=org.opencontainers.image.title=GoHoarder Scanner"
|
||||
- "--label=org.opencontainers.image.description=GoHoarder vulnerability scanning engine"
|
||||
- "--label=org.opencontainers.image.url=https://github.com/lukaszraczylo/gohoarder"
|
||||
- "--label=org.opencontainers.image.source=https://github.com/lukaszraczylo/gohoarder"
|
||||
- "--label=org.opencontainers.image.version={{ .Version }}"
|
||||
- "--label=org.opencontainers.image.created={{ .Date }}"
|
||||
- "--label=org.opencontainers.image.revision={{ .FullCommit }}"
|
||||
extra_files:
|
||||
- go.mod
|
||||
- go.sum
|
||||
- cmd
|
||||
- pkg
|
||||
- internal
|
||||
- config.yaml.example
|
||||
|
||||
# 4. Gateway - Nginx reverse proxy for unified deployment
|
||||
- id: gohoarder-gateway
|
||||
use: buildx
|
||||
images:
|
||||
- ghcr.io/lukaszraczylo/gohoarder-gateway
|
||||
build_flag_templates:
|
||||
- "--platform=linux/amd64,linux/arm64"
|
||||
tags:
|
||||
- "{{ .Version }}"
|
||||
- latest
|
||||
platforms:
|
||||
- linux/amd64
|
||||
- linux/arm64
|
||||
dockerfile: Dockerfile.gateway
|
||||
labels:
|
||||
org.opencontainers.image.title: GoHoarder Gateway
|
||||
org.opencontainers.image.description: Nginx reverse proxy for unified GoHoarder deployment
|
||||
org.opencontainers.image.url: https://github.com/lukaszraczylo/gohoarder
|
||||
org.opencontainers.image.source: https://github.com/lukaszraczylo/gohoarder
|
||||
org.opencontainers.image.version: "{{ .Version }}"
|
||||
org.opencontainers.image.created: "{{ .Date }}"
|
||||
org.opencontainers.image.revision: "{{ .FullCommit }}"
|
||||
flags:
|
||||
- "--pull"
|
||||
- "--label=org.opencontainers.image.title=GoHoarder Gateway"
|
||||
- "--label=org.opencontainers.image.description=Nginx reverse proxy for unified GoHoarder deployment"
|
||||
- "--label=org.opencontainers.image.url=https://github.com/lukaszraczylo/gohoarder"
|
||||
- "--label=org.opencontainers.image.source=https://github.com/lukaszraczylo/gohoarder"
|
||||
- "--label=org.opencontainers.image.version={{ .Version }}"
|
||||
- "--label=org.opencontainers.image.created={{ .Date }}"
|
||||
- "--label=org.opencontainers.image.revision={{ .FullCommit }}"
|
||||
|
||||
# 5. Migration Engine - Database migration tool
|
||||
- id: gohoarder-migrate
|
||||
use: buildx
|
||||
images:
|
||||
- ghcr.io/lukaszraczylo/gohoarder-migrate
|
||||
build_flag_templates:
|
||||
- "--platform=linux/amd64,linux/arm64"
|
||||
- "--build-arg=VERSION={{ .Version }}"
|
||||
- "--build-arg=GIT_COMMIT={{ .ShortCommit }}"
|
||||
- "--build-arg=BUILD_TIME={{ .Date }}"
|
||||
tags:
|
||||
- "{{ .Version }}"
|
||||
- latest
|
||||
platforms:
|
||||
- linux/amd64
|
||||
- linux/arm64
|
||||
dockerfile: Dockerfile.migrate
|
||||
labels:
|
||||
org.opencontainers.image.title: GoHoarder Migrate
|
||||
org.opencontainers.image.description: Database migration tool for GoHoarder V2 schema
|
||||
org.opencontainers.image.url: https://github.com/lukaszraczylo/gohoarder
|
||||
org.opencontainers.image.source: https://github.com/lukaszraczylo/gohoarder
|
||||
org.opencontainers.image.version: "{{ .Version }}"
|
||||
org.opencontainers.image.created: "{{ .Date }}"
|
||||
org.opencontainers.image.revision: "{{ .FullCommit }}"
|
||||
build_args:
|
||||
VERSION: "{{ .Version }}"
|
||||
GIT_COMMIT: "{{ .ShortCommit }}"
|
||||
BUILD_TIME: "{{ .Date }}"
|
||||
flags:
|
||||
- "--pull"
|
||||
- "--label=org.opencontainers.image.title=GoHoarder Migrate"
|
||||
- "--label=org.opencontainers.image.description=Database migration tool for GoHoarder V2 schema"
|
||||
- "--label=org.opencontainers.image.url=https://github.com/lukaszraczylo/gohoarder"
|
||||
- "--label=org.opencontainers.image.source=https://github.com/lukaszraczylo/gohoarder"
|
||||
- "--label=org.opencontainers.image.version={{ .Version }}"
|
||||
- "--label=org.opencontainers.image.created={{ .Date }}"
|
||||
- "--label=org.opencontainers.image.revision={{ .FullCommit }}"
|
||||
extra_files:
|
||||
- go.mod
|
||||
- go.sum
|
||||
- cmd
|
||||
- pkg
|
||||
- internal
|
||||
- migrations
|
||||
|
||||
# Artifact signing with cosign
|
||||
signs:
|
||||
|
||||
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