From 230d7529b260df7090c625f876cf0502d72d7b97 Mon Sep 17 00:00:00 2001 From: Xe Date: Thu, 17 Mar 2022 15:25:45 -0400 Subject: [PATCH] add docker build Signed-off-by: Xe --- .gitignore | 3 ++- flake.nix | 22 ++++++++++++++++++---- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index f50fd11..1c221d0 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -/grafanauth \ No newline at end of file +/grafanauth +/result diff --git a/flake.nix b/flake.nix index ea89290..6c0da53 100644 --- a/flake.nix +++ b/flake.nix @@ -20,7 +20,7 @@ defaultPackage = pkgs.buildGoModule { pname = "grafanauth"; inherit version; - src = ./.; + src = builtins.path { path = ./.; name = "grafanauth"; }; # This hash locks the dependencies of this package. It is # necessary because of how Go requires network access to resolve @@ -30,11 +30,25 @@ # it should be "out-of-band" with other tooling (eg. gomod2nix). # To begin with it is recommended to set this, but one must # remeber to bump this hash when your dependencies change. - vendorSha256 = pkgs.lib.fakeSha256; - #vendorSha256 = "sha256-pQpattmS9VmO3ZIQUFn66az8GSmB4IvYhTTCFn6SUmo="; + #vendorSha256 = pkgs.lib.fakeSha256; + vendorSha256 = "sha256-nPtSpqIXB75PYsMoULIxFRPbRxxfn2CqzVE3Mb7/1Jg="; }; - packages = { }; + packages = { + docker = let grafanauth = self.defaultPackage.${system}; + in pkgs.dockerTools.buildLayeredImage { + name = grafanauth.pname; + tag = grafanauth.version; + contents = [ grafanauth ]; + + config = { + Entrypoint = [ "/bin/grafanauth" ]; + WorkingDir = [ "/" ]; + Volumes = { "/data" = { }; }; + Env = [ "XDG_CONFIG_HOME=/data" ]; + }; + }; + }; defaultApp = utils.lib.mkApp { drv = self.defaultPackage.${system};