Skip to content

Commit 87c2e1f

Browse files
committed
feat: add stapeln.toml layer-based container definition\n\nConverted from existing Containerfile to stapeln format.\nIncludes Chainguard base, security hardening, SBOM generation.\n\nCo-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 2495072 commit 87c2e1f

1 file changed

Lines changed: 99 additions & 0 deletions

File tree

stapeln.toml

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
# SPDX-License-Identifier: PMPL-1.0-or-later
2+
# stapeln.toml — Layer-based container build for presswerk
3+
#
4+
# stapeln builds containers as composable layers (German: "to stack").
5+
# Each layer is independently cacheable, verifiable, and signable.
6+
7+
[metadata]
8+
name = "presswerk"
9+
version = "0.1.0"
10+
description = "presswerk container service"
11+
author = "Jonathan D.A. Jewell <j.d.a.jewell@open.ac.uk>"
12+
license = "PMPL-1.0-or-later"
13+
registry = "ghcr.io/hyperpolymath"
14+
15+
[build]
16+
containerfile = "Containerfile"
17+
context = "."
18+
runtime = "podman"
19+
20+
# ── Layer Definitions ──────────────────────────────────────────
21+
22+
[layers.base]
23+
description = "Chainguard Wolfi minimal base"
24+
from = "cgr.dev/chainguard/wolfi-base:latest"
25+
cache = true
26+
verify = true
27+
28+
[layers.rust-toolchain]
29+
description = "Rust compiler and build dependencies"
30+
extends = "base"
31+
packages = ["rust", "pkgconf", "build-base"]
32+
cache = true
33+
34+
[layers.rust-deps]
35+
description = "Cargo dependency fetch"
36+
extends = "rust-toolchain"
37+
commands = ["cargo fetch --locked"]
38+
cache-key = "Cargo.lock"
39+
cache = true
40+
41+
[layers.build]
42+
description = "presswerk Rust compilation"
43+
extends = "rust-deps"
44+
commands = ["cargo build --release"]
45+
artifacts = [
46+
{ src = "target/release/presswerk", dst = "/app/presswerk" },
47+
]
48+
49+
[layers.runtime]
50+
description = "Minimal runtime"
51+
from = "cgr.dev/chainguard/wolfi-base:latest"
52+
packages = ["ca-certificates", "curl"]
53+
copy-from = [
54+
{ layer = "build", src = "/app/", dst = "/app/" },
55+
]
56+
entrypoint = ["["/app/presswerk"]"]
57+
user = "presswerk"
58+
expose = [631, 8000]
59+
env = { PRESSWERK_HEADLESS = "true", PRESSWERK_PORT = "631", VORDR_ENDPOINT = "selur://unix:///run/presswerk.sock", CT_TRUST_STORE = "/etc/presswerk/trust-store", PRESSWERK_DATA_DIR = "/var/lib/presswerk", PRESSWERK_LOG_LEVEL = "info", SVALINN_POLICY = "/etc/presswerk/svalinn-policy.yaml", SVALINN_PORT = "8000", SELUR_WASM = "/app/lib/presswerk-bridge.wasm" }
60+
61+
# ── Security ───────────────────────────────────────────────────
62+
63+
[security]
64+
non-root = true
65+
read-only-root = false
66+
no-new-privileges = true
67+
cap-drop = ["ALL"]
68+
seccomp-profile = "default"
69+
70+
[security.signing]
71+
algorithm = "ML-DSA-87"
72+
provider = "cerro-torre"
73+
74+
[security.sbom]
75+
format = "spdx-json"
76+
output = "sbom.spdx.json"
77+
include-deps = true
78+
79+
# ── Verification ───────────────────────────────────────────────
80+
81+
[verify]
82+
vordr = true
83+
svalinn = true
84+
scan-on-build = true
85+
fail-on = ["critical", "high"]
86+
87+
# ── Targets ────────────────────────────────────────────────────
88+
89+
[targets.development]
90+
layers = ["base", "rust-toolchain", "build"]
91+
env = { LOG_LEVEL = "debug" }
92+
93+
[targets.production]
94+
layers = ["runtime"]
95+
env = { LOG_LEVEL = "info" }
96+
97+
[targets.test]
98+
layers = ["base", "rust-toolchain", "build"]
99+
env = { LOG_LEVEL = "debug" }

0 commit comments

Comments
 (0)