feat: ESLint, shell completions, Docker, nfpm packaging, CI/CD
- ESLint with typescript-eslint + prettier (eslint.config.js)
- Shell completions for bash and fish (scripts/generate-completions.ts)
- Multi-stage Dockerfile for bastion (fedora:43 + dnsmasq + node)
- nfpm.yaml for RPM/DEB packaging with bun-compiled binary
- Build scripts: build-rpm.sh, build-bastion.sh, publish-rpm/deb.sh
- Gitea Actions CI/CD: lint, typecheck, test, build, publish
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-17 21:51:01 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
# Build bastion container image and push to Gitea container registry
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
|
|
|
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
|
|
|
|
|
cd "$PROJECT_ROOT"
|
|
|
|
|
|
|
|
|
|
# Load .env for GITEA_TOKEN
|
|
|
|
|
if [ -f .env ]; then
|
|
|
|
|
set -a; source .env; set +a
|
|
|
|
|
fi
|
|
|
|
|
|
2026-03-17 22:02:52 +00:00
|
|
|
# ── Argument parsing ───────────────────────────────────────────────
|
|
|
|
|
TARGET_ARCH=""
|
|
|
|
|
|
|
|
|
|
usage() {
|
|
|
|
|
cat <<EOF
|
|
|
|
|
Usage: $(basename "$0") [OPTIONS] [TAG]
|
|
|
|
|
|
|
|
|
|
Build bastion container image and optionally push to registry.
|
|
|
|
|
|
|
|
|
|
Options:
|
|
|
|
|
--arch ARCH Target platform: x86_64 or arm64 (default: host arch)
|
|
|
|
|
-h, --help Show this help message
|
|
|
|
|
|
|
|
|
|
Arguments:
|
|
|
|
|
TAG Image tag (default: version from package.json)
|
|
|
|
|
EOF
|
|
|
|
|
exit 0
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
POSITIONAL_ARGS=()
|
|
|
|
|
while [[ $# -gt 0 ]]; do
|
|
|
|
|
case "$1" in
|
|
|
|
|
--arch)
|
|
|
|
|
TARGET_ARCH="$2"
|
|
|
|
|
shift 2
|
|
|
|
|
;;
|
|
|
|
|
-h|--help)
|
|
|
|
|
usage
|
|
|
|
|
;;
|
|
|
|
|
*)
|
|
|
|
|
POSITIONAL_ARGS+=("$1")
|
|
|
|
|
shift
|
|
|
|
|
;;
|
|
|
|
|
esac
|
|
|
|
|
done
|
|
|
|
|
|
feat: ESLint, shell completions, Docker, nfpm packaging, CI/CD
- ESLint with typescript-eslint + prettier (eslint.config.js)
- Shell completions for bash and fish (scripts/generate-completions.ts)
- Multi-stage Dockerfile for bastion (fedora:43 + dnsmasq + node)
- nfpm.yaml for RPM/DEB packaging with bun-compiled binary
- Build scripts: build-rpm.sh, build-bastion.sh, publish-rpm/deb.sh
- Gitea Actions CI/CD: lint, typecheck, test, build, publish
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-17 21:51:01 +00:00
|
|
|
# Registry defaults to internal address (external proxy has body size limit)
|
|
|
|
|
REGISTRY="${GITEA_REGISTRY:-mysources.co.uk}"
|
|
|
|
|
IMAGE="lab-bastion"
|
|
|
|
|
VERSION=$(node -p "require('./package.json').version")
|
2026-03-17 22:02:52 +00:00
|
|
|
TAG="${POSITIONAL_ARGS[0]:-$VERSION}"
|
|
|
|
|
|
|
|
|
|
# ── Resolve target platform ───────────────────────────────────────
|
|
|
|
|
detect_host_arch() {
|
|
|
|
|
local machine
|
|
|
|
|
machine="$(uname -m)"
|
|
|
|
|
case "$machine" in
|
|
|
|
|
x86_64) echo "x86_64" ;;
|
|
|
|
|
aarch64) echo "arm64" ;;
|
|
|
|
|
arm64) echo "arm64" ;;
|
|
|
|
|
*) echo "$machine" ;;
|
|
|
|
|
esac
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
docker_platform_for() {
|
|
|
|
|
case "$1" in
|
|
|
|
|
x86_64) echo "linux/amd64" ;;
|
|
|
|
|
arm64) echo "linux/arm64" ;;
|
|
|
|
|
esac
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ARCH="${TARGET_ARCH:-$(detect_host_arch)}"
|
|
|
|
|
PLATFORM="$(docker_platform_for "$ARCH")"
|
feat: ESLint, shell completions, Docker, nfpm packaging, CI/CD
- ESLint with typescript-eslint + prettier (eslint.config.js)
- Shell completions for bash and fish (scripts/generate-completions.ts)
- Multi-stage Dockerfile for bastion (fedora:43 + dnsmasq + node)
- nfpm.yaml for RPM/DEB packaging with bun-compiled binary
- Build scripts: build-rpm.sh, build-bastion.sh, publish-rpm/deb.sh
- Gitea Actions CI/CD: lint, typecheck, test, build, publish
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-17 21:51:01 +00:00
|
|
|
|
2026-03-17 22:02:52 +00:00
|
|
|
echo "==> Building bastion image (tag: $TAG, platform: $PLATFORM)..."
|
|
|
|
|
podman build --platform "$PLATFORM" -t "$IMAGE:$TAG" -f stack/Dockerfile .
|
feat: ESLint, shell completions, Docker, nfpm packaging, CI/CD
- ESLint with typescript-eslint + prettier (eslint.config.js)
- Shell completions for bash and fish (scripts/generate-completions.ts)
- Multi-stage Dockerfile for bastion (fedora:43 + dnsmasq + node)
- nfpm.yaml for RPM/DEB packaging with bun-compiled binary
- Build scripts: build-rpm.sh, build-bastion.sh, publish-rpm/deb.sh
- Gitea Actions CI/CD: lint, typecheck, test, build, publish
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-17 21:51:01 +00:00
|
|
|
|
|
|
|
|
echo "==> Tagging as $REGISTRY/michal/$IMAGE:$TAG..."
|
|
|
|
|
podman tag "$IMAGE:$TAG" "$REGISTRY/michal/$IMAGE:$TAG"
|
|
|
|
|
|
|
|
|
|
if [ -n "$GITEA_TOKEN" ]; then
|
|
|
|
|
echo "==> Logging in to $REGISTRY..."
|
|
|
|
|
podman login --tls-verify=false -u michal -p "$GITEA_TOKEN" "$REGISTRY"
|
|
|
|
|
|
|
|
|
|
echo "==> Pushing to $REGISTRY/michal/$IMAGE:$TAG..."
|
|
|
|
|
podman push --tls-verify=false "$REGISTRY/michal/$IMAGE:$TAG"
|
|
|
|
|
|
|
|
|
|
# Ensure package is linked to the repository
|
|
|
|
|
if [ -f "$SCRIPT_DIR/link-package.sh" ]; then
|
|
|
|
|
source "$SCRIPT_DIR/link-package.sh"
|
|
|
|
|
link_package "container" "$IMAGE"
|
|
|
|
|
fi
|
|
|
|
|
else
|
|
|
|
|
echo "==> GITEA_TOKEN not set, skipping push."
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
echo "==> Done!"
|
|
|
|
|
echo " Image: $REGISTRY/michal/$IMAGE:$TAG"
|
2026-03-17 22:02:52 +00:00
|
|
|
echo " Platform: $PLATFORM"
|