Extend go_build() with buildmode and extra_env params, migrate miniflux and forgejo-runner to use it, and bump all Alpine bases from 3.22 to 3.23. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
48 lines
1.3 KiB
Python
48 lines
1.3 KiB
Python
"""Miniflux RSS feed reader — native Dagger build.
|
|
|
|
Two-stage build: Go (backend with PIE), Alpine (runtime).
|
|
Source cloned from forge mirror.
|
|
"""
|
|
|
|
import dagger
|
|
|
|
from blumeops.containers import (
|
|
alpine_runtime,
|
|
clone_from_forge,
|
|
go_build,
|
|
oci_labels,
|
|
)
|
|
|
|
VERSION = "2.2.19"
|
|
|
|
|
|
async def build(src: dagger.Directory) -> dagger.Container:
|
|
source = clone_from_forge("miniflux", VERSION)
|
|
|
|
# Stage 1: Build Go backend (PIE mode, matching upstream Makefile)
|
|
backend = go_build(
|
|
source,
|
|
"/miniflux",
|
|
buildmode="pie",
|
|
ldflags=f"-s -w -X 'miniflux.app/v2/internal/version.Version={VERSION}'",
|
|
cgo_enabled=True,
|
|
)
|
|
|
|
# Stage 2: Runtime (uses Alpine's built-in nobody:65534)
|
|
runtime = alpine_runtime(
|
|
extra_apk=["ca-certificates", "tzdata"],
|
|
create_user=False,
|
|
)
|
|
runtime = oci_labels(
|
|
runtime,
|
|
title="Miniflux",
|
|
description="Miniflux is a minimalist and opinionated feed reader",
|
|
version=VERSION,
|
|
)
|
|
return (
|
|
runtime.with_file("/usr/bin/miniflux", backend.file("/miniflux"))
|
|
.with_exposed_port(8080)
|
|
.with_env_variable("LISTEN_ADDR", "0.0.0.0:8080")
|
|
.with_user("65534")
|
|
.with_default_args(args=["/usr/bin/miniflux"])
|
|
)
|