Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Apodeixis.jl_chora.deed
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,9 @@
(directory :id "automation-unit-forge" :ply 3 :path ".machine_readable/scripts/forge" :description "Internal automation logic for project forge.")
(directory :id "automation-unit-lifecycle" :ply 3 :path ".machine_readable/scripts/lifecycle" :description "Internal automation logic for project lifecycle.")
(directory :id "automation-unit-verification" :ply 3 :path ".machine_readable/scripts/verification" :description "Internal automation logic for project verification.")))
(directory :id "container-templates" :ply 1 :path "build/container" :version "1.0.0" :description "Container templates for the stapeln container ecosystem. This directory\nprovides Podman-Chainguard-stapeln templates that are customised via\n`just container-init` or `just repo-init` during project bootstrap.\n\nAll files use {{PLACEHOLDER}} tokens that are substituted with project-\nspecific values during initialisation." :purpose "Provide a complete, security-first container deployment story for any\nRSR-compliant repository. The templates cover the full lifecycle:\nbuild, sign, verify, deploy, monitor, and govern." :overview "The stapeln container ecosystem comprises six tools:\n\nselur — Container orchestration with zero-copy IPC. Reads compose.toml.\ncerro-torre — Verified container packaging (.ctp bundles), Ed25519 signing.\nsvalinn — Policy-driven edge gateway (auth, rate limits, CORS, trust).\nvordr — Runtime monitoring (health, crashes, resources, logs).\nrokur — Secrets management (runtime injection, no baked secrets).\nk9-svc — Nickel deployment components (Kennel/Yard/Hunt trust levels)."
(directory :id "container-templates" :ply 1 :path "build/container" :version "1.0.0" :description "Container templates for the stapeln container ecosystem. This directory\nprovides Podman-Chainguard-stapeln templates that are customised via\n`just container-init` or `just repo-init` during project bootstrap.\n\nAll files use {{PLACEHOLDER}} tokens that are substituted with project-\nspecific values during initialisation."
:purpose "Provide a complete, security-first container deployment story for any\nRSR-compliant repository. The templates cover the full lifecycle:\nbuild, sign, verify, deploy, monitor, and govern."
:overview "The stapeln container ecosystem comprises six tools:\n\nselur — Container orchestration with zero-copy IPC. Reads compose.toml.\ncerro-torre — Verified container packaging (.ctp bundles), Ed25519 signing.\nsvalinn — Policy-driven edge gateway (auth, rate limits, CORS, trust).\nvordr — Runtime monitoring (health, crashes, resources, logs).\nrokur — Secrets management (runtime injection, no baked secrets).\nk9-svc — Nickel deployment components (Kennel/Yard/Hunt trust levels)."
:context ("https://stapeln.dev/ns/v1")
(canonical-locations :build_pipeline "build/container/stapeln/ct-build.sh" :compose "build/container/stapeln/compose.toml" :compose_example "build/container/stapeln/compose.example.toml" :compose_portable "build/container/compose.yaml" :compose_portable_example "build/container/compose.example.yaml" :containerfile "build/container/Containerfile" :containerignore "build/container/.containerignore" :deployment "build/container/stapeln/deploy.k9.ncl" :entrypoint "build/container/entrypoint.sh" :gatekeeper "build/container/stapeln/.gatekeeper.yaml" :just_module "build/just/container.just" :manifest "build/container/stapeln/manifest.toml" :monitoring "build/container/stapeln/vordr.toml" :secrets_gate "build/container/stapeln/rokur.toml")
:invariants ("Base images MUST be cgr.dev/chainguard/wolfi-base or cgr.dev/chainguard/static" "Container runtime is Podman — never Docker" "Containerfile — never Dockerfile" "All images run as non-root (appuser or project-specific user)" ".ctp bundles are signed with Ed25519 via cerro-torre" "Health endpoints (/health, /ready) must always be public (no auth)")
Expand Down
18 changes: 11 additions & 7 deletions build/container/Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,16 @@
# RUN zig build -Doptimize=ReleaseFast
# # Output: /build/zig-out/bin/apodeixis.jl
#
# Base image: `:latest` is right for a template scaffold (Chainguard rebuilds
# Wolfi daily). For PRODUCTION builds, pin by digest for reproducibility/supply-
# chain integrity, e.g.:
# FROM cgr.dev/chainguard/wolfi-base:latest@sha256:<digest> AS builder
# (cerro-torre's .ctp signing in build/container/stapeln/ records the resolved digest.)
FROM cgr.dev/chainguard/wolfi-base:latest AS builder
# Base image: pinned by digest only (TRUST-DEFAULTS-POLICY, check-container-pins.sh).
# The digest is the multi-arch (amd64 + arm64) OCI index that
# cgr.dev/chainguard/wolfi-base:latest resolved to on 2026-11-14. A tag next to a
# digest is ignored by the runtime, so none is written. Chainguard rebuilds Wolfi
# daily; refresh the pin deliberately and update BOTH FROM lines. Use the digest
# of the top-level index (media type application/vnd.oci.image.index.v1+json),
# which is the Docker-Content-Digest the registry returns for the :latest
# manifest request, NOT one of the per-platform digests that
# `podman image inspect` may also list under RepoDigests.
FROM cgr.dev/chainguard/wolfi-base@sha256:1f6b749929164c3d9e7cad0289254f39b2ba51e1dddaeb0fa57532ea03f2db31 AS builder

# TODO: Install your language toolchain
RUN apk add --no-cache build-base
Expand All @@ -79,7 +83,7 @@ COPY . .
# Minimal production image. Only the compiled binary/release and runtime
# dependencies are included. No compilers, no source code, no build tools.
#
FROM cgr.dev/chainguard/wolfi-base:latest
FROM cgr.dev/chainguard/wolfi-base@sha256:1f6b749929164c3d9e7cad0289254f39b2ba51e1dddaeb0fa57532ea03f2db31

# OCI image labels (compatible with cerro-torre .ctp bundle metadata)
LABEL org.opencontainers.image.title="Apodeixis.jl" \
Expand Down
14 changes: 12 additions & 2 deletions src/interface/ffi/src/main.zig
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,16 @@ fn clearError() void {
last_error = null;
}

/// Duplicate a byte slice as a NUL-terminated buffer across Zig 0.15/0.16/0.17
/// (`Allocator.dupeZ` was removed in Zig 0.17).
/// The caller owns the returned slice and must free it with `allocator`.
/// Propagates allocation failure.
fn dupeZ(allocator: std.mem.Allocator, bytes: []const u8) ![:0]u8 {
const buf = try allocator.allocSentinel(u8, bytes.len, 0);
@memcpy(buf[0..bytes.len], bytes);
return buf;
}

//==============================================================================
// Core Types (must match src/abi/Types.idr)
//==============================================================================
Expand Down Expand Up @@ -123,7 +133,7 @@ export fn apodeixis_jl_get_string(handle: ?*Handle) ?[*:0]const u8 {
}

// Example: allocate and return a string
const result = h.allocator.dupeZ(u8, "Example result") catch {
const result = dupeZ(h.allocator, "Example result") catch {
setError("Failed to allocate string");
return null;
};
Expand Down Expand Up @@ -187,7 +197,7 @@ export fn apodeixis_jl_last_error() ?[*:0]const u8 {

// Return C string (static storage, no need to free)
const allocator = std.heap.c_allocator;
const c_str = allocator.dupeZ(u8, err) catch return null;
const c_str = dupeZ(allocator, err) catch return null;
return c_str.ptr;
}

Expand Down
Loading