Init container that fetches the deployable JAR from a signed URL into the shared /app/jars/ volume before the main runtime container starts. Pairs with the controller (Task 7) and DockerRuntimeOrchestrator (Task 10). - Dockerfile: busybox:1.37-musl, non-root USER (UID 1000) - entrypoint.sh: POSIX sh, set -eu, required env vars (ARTIFACT_URL, ARTIFACT_EXPECTED_SIZE), wget with retries/timeout, size verification - README: build instructions and runtime contract Smoke-tested locally (docker build + happy-path fetch + size-mismatch). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
26 lines
921 B
Bash
26 lines
921 B
Bash
#!/bin/sh
|
|
# cameleer-runtime-loader: fetches one JAR from a signed URL into the shared
|
|
# /app/jars/ volume, verifies size, exits. Runs in the same hardened sandbox as
|
|
# the main container (cap_drop ALL, read-only rootfs, etc.) — only /app/jars/
|
|
# is writeable.
|
|
set -eu
|
|
|
|
: "${ARTIFACT_URL:?ARTIFACT_URL is required}"
|
|
: "${ARTIFACT_EXPECTED_SIZE:?ARTIFACT_EXPECTED_SIZE is required}"
|
|
|
|
OUT=/app/jars/app.jar
|
|
mkdir -p /app/jars
|
|
|
|
echo "loader: fetching artifact (expected $ARTIFACT_EXPECTED_SIZE bytes)"
|
|
# -q quiet, -O output, --tries=3 retry transient network blips,
|
|
# --timeout=30 cap stalls. wget exits non-zero on HTTP >=400.
|
|
wget -q --tries=3 --timeout=30 -O "$OUT" "$ARTIFACT_URL"
|
|
|
|
actual=$(wc -c < "$OUT")
|
|
if [ "$actual" -ne "$ARTIFACT_EXPECTED_SIZE" ]; then
|
|
echo "loader: size mismatch — expected $ARTIFACT_EXPECTED_SIZE, got $actual" >&2
|
|
exit 2
|
|
fi
|
|
|
|
echo "loader: artifact written to $OUT ($actual bytes)"
|