Files
archy/apps/podsteadr/build-from-prototype.sh
ssmithxandClaude Opus 5.5 11c5dfe2ba fix(podsteadr): build both images under registry tags on Archipelago hosts
build-from-prototype.sh and push-to-registry.sh now build podsteadr and
podsteadr-player under the tags the manifests use. Rootless podman on
Archipelago hosts sees /var/tmp read-only, so stage builds under
~/.cache/podman-build-tmp, and tag by image id after build: 'build -t' of a
fully cached image copies through /var/tmp and fails. README documents the
four-container stack, both builds and FIPS access.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 19:37:06 +00:00

66 lines
2.5 KiB
Bash
Executable File

#!/bin/bash
# Build the podsteadr and podsteadr-player container images locally, under the
# exact tags their manifests reference, so a node can install the stack
# without pulling them (pull_policy: if-not-present).
#
# Usage: ./build-from-prototype.sh [path-to-podsteadr-repo] [path-to-podsteadr-player-repo]
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_DIR="${1:-$HOME/podsteadr}"
PLAYER_DIR="${2:-$HOME/podsteadr-player}"
REGISTRY_PATH="source.archipelago-foundation.org/lfg2025"
VERSION="1.0.0"
if [ ! -f "$REPO_DIR/server/package.json" ] || [ ! -f "$REPO_DIR/frontend/package.json" ]; then
echo "podsteadr repo not found at: $REPO_DIR (expected server/ and frontend/)"
echo " Usage: $0 /path/to/podsteadr /path/to/podsteadr-player"
exit 1
fi
if [ ! -f "$PLAYER_DIR/Dockerfile" ] || [ ! -f "$PLAYER_DIR/njs/fips.js" ]; then
echo "podsteadr-player repo not found at: $PLAYER_DIR (expected Dockerfile and njs/fips.js)"
echo " Usage: $0 /path/to/podsteadr /path/to/podsteadr-player"
exit 1
fi
RUNTIME="podman"
if ! command -v podman >/dev/null 2>&1; then
RUNTIME="docker"
fi
# On Archipelago hosts rootless podman stages builds and pulls in /var/tmp,
# which it sees read-only (its namespace comes from the sandboxed archipelago
# service, so a writability test from this shell can't detect it). Stage in
# the home directory instead unless TMPDIR is already set.
if [ "$RUNTIME" = "podman" ] && [ -z "${TMPDIR:-}" ]; then
export TMPDIR="$HOME/.cache/podman-build-tmp"
mkdir -p "$TMPDIR"
fi
# Build, then tag by image id. `build -t` re-tags a fully cached image by
# copying it through a temp dir that ignores TMPDIR (/var/tmp, read-only on
# Archipelago hosts), so re-running a build fails; `tag` is metadata-only.
build_and_tag() {
local tag="$1"; shift
local iidfile
iidfile="$(mktemp)"
$RUNTIME build --iidfile "$iidfile" "$@"
$RUNTIME tag "$(cat "$iidfile")" "$tag"
rm -f "$iidfile"
}
echo "Building podsteadr from $REPO_DIR using $SCRIPT_DIR/Dockerfile"
build_and_tag "$REGISTRY_PATH/podsteadr:$VERSION" -f "$SCRIPT_DIR/Dockerfile" "$REPO_DIR"
# The player's Dockerfile, nginx.conf and FIPS gateway (njs/) live in its own
# repo and are used as-is.
echo "Building podsteadr-player from $PLAYER_DIR"
build_and_tag "$REGISTRY_PATH/podsteadr-player:$VERSION" "$PLAYER_DIR"
echo ""
echo "Built $REGISTRY_PATH/podsteadr:$VERSION"
echo "Built $REGISTRY_PATH/podsteadr-player:$VERSION"
echo ""
echo "You can now install podsteadr from the App Store in Archipelago on this node."