2023-02-17 00:27:28 +00:00
|
|
|
import { join } from "node:path";
|
2023-02-17 00:37:00 +00:00
|
|
|
import { buildRepro, reproRun } from "../../helpers/repro-run.js";
|
2023-02-17 00:27:28 +00:00
|
|
|
|
|
|
|
const LOKI_VERSION = "v2.7.3";
|
|
|
|
|
|
|
|
// returns path to statically compiled binary
|
2023-02-17 00:37:00 +00:00
|
|
|
export function buildLoki(): Promise<string> {
|
|
|
|
return buildRepro(
|
|
|
|
"loki",
|
|
|
|
LOKI_VERSION,
|
|
|
|
`#!/bin/sh -e
|
2023-02-17 00:27:28 +00:00
|
|
|
runprint() {
|
|
|
|
echo "==> $@"
|
|
|
|
"$@"
|
|
|
|
}
|
|
|
|
|
|
|
|
runprint apk add --quiet git go make libc-dev bash
|
|
|
|
|
|
|
|
git config --global advice.detachedHead false
|
|
|
|
# TODO: cachear clon de repo
|
|
|
|
runprint git clone https://github.com/grafana/loki --branch '${LOKI_VERSION}' --depth 1 --single-branch
|
|
|
|
cd loki
|
|
|
|
|
|
|
|
runprint make -j1 GOMOD=readonly logcli loki
|
|
|
|
mv cmd/loki/loki /loki
|
2023-02-17 00:37:00 +00:00
|
|
|
`,
|
|
|
|
(dir) =>
|
|
|
|
reproRun({
|
|
|
|
cwd: dir,
|
|
|
|
command: "/src/build",
|
|
|
|
cache: [
|
|
|
|
"/home/repro/.cache/go-build",
|
|
|
|
"/home/repro/go",
|
|
|
|
"/home/repro/.npm",
|
|
|
|
],
|
|
|
|
}),
|
|
|
|
(dir) => join(dir, "rootfs/loki")
|
|
|
|
);
|
2023-02-17 00:27:28 +00:00
|
|
|
}
|