blumeops/containers/valkey/container.py
Erich Blume 02859c55d1 C1(valkey-nix): add nix-built amd64 variant for ringtail/immich
`containers/valkey/container.py` builds Alpine 3.22 arm64 on the indri
k8s runner (used by paperless). Adding `containers/valkey/default.nix`
gives us an amd64 image built via nix on the ringtail
nix-container-builder, so immich-ringtail can stop pulling the upstream
`docker.io/valkey/valkey` multi-arch image.

Both builds track upstream valkey 8.1.x; bumping to 8.1.7 (Alpine 3.22
ships 8.1.7-r0, nixpkgs ships 8.1.7) — version-check now reports
`container.py=8.1.7, nix=8.1.7, service-versions=8.1.7`.

A follow-up commit on this branch will swap the immich-ringtail and
paperless kustomization tags once both builds succeed.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-28 10:21:02 -07:00

48 lines
1.4 KiB
Python

"""Valkey — native Dagger build (arm64, indri).
Alpine 3.22 base with the `valkey` apk package (8.1.x — Redis-compatible).
Used by paperless (sidecar) on indri. immich on ringtail uses the
nix-built amd64 variant from `default.nix` in this directory.
"""
import dagger
from dagger import dag
from blumeops.containers import oci_labels
# Alpine 3.22 currently ships valkey 8.1.7-r0. Alpine 3.23 jumps to 9.0 —
# hold on 3.22 to keep this aligned with the 8.1 line.
VERSION = "8.1.7"
ALPINE_PIN = "8.1.7-r0"
ALPINE_BASE = "alpine:3.22"
async def build(src: dagger.Directory) -> dagger.Container:
ctr = (
dag.container()
.from_(ALPINE_BASE)
.with_exec(["apk", "add", "--no-cache", f"valkey={ALPINE_PIN}"])
.with_exec(["mkdir", "-p", "/data"])
.with_exec(["chown", "valkey:valkey", "/data"])
.with_workdir("/data")
.with_exposed_port(6379)
.with_user("valkey")
.with_default_args(
args=[
"valkey-server",
"--bind",
"0.0.0.0",
"--protected-mode",
"no",
"--dir",
"/data",
]
)
)
return oci_labels(
ctr,
title="Valkey",
description="Valkey high-performance key/value datastore (Redis-compatible)",
version=VERSION,
)