Remove init containers

Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
2025-07-06 12:20:45 +01:00
parent 48d3ba5092
commit 5c098a8aa9
19 changed files with 210 additions and 232 deletions

View File

@@ -1,21 +1,34 @@
{ pkgs, ... }:
let
entrypoint = pkgs.writeTextFile {
name = "entrypoint";
executable = true;
destination = "/bin/entrypoint";
text = builtins.readFile ./entrypoint.sh;
};
in
pkgs.dockerTools.buildImage {
name = "prometheus";
fromImage = import ../base { inherit pkgs; };
copyToRoot = pkgs.buildEnv {
name = "root";
paths = with pkgs; [ prometheus ];
paths = with pkgs; [
entrypoint
prometheus
yq-go
];
pathsToLink = [ "/bin" ];
};
config = {
Entrypoint = [ "prometheus" ];
Entrypoint = [ "entrypoint" ];
ExposedPorts = {
"9090/tcp" = { };
};
WorkingDir = "/var/lib/prometheus";
Volumes = {
"/etc/prometheus" = { };
"/var/lib/prometheus" = { };
};
};

View File

@@ -0,0 +1,14 @@
#!/usr/bin/env sh
set -o errexit
set -o nounset
if [ -d /etc/prometheus/conf.d ]; then
# shellcheck disable=SC2016
yq eval-all '. as $item ireduce ({}; . *+ $item)' /etc/prometheus/conf.d/*.yaml > /etc/prometheus/prometheus.yaml
fi
exec prometheus \
--config.file=/etc/prometheus/prometheus.yaml \
--storage.tsdb.path=/var/lib/prometheus \
"$@"