add docker build

Signed-off-by: Xe <me@christine.website>
This commit is contained in:
Cadey Ratio 2022-03-17 15:25:45 -04:00
parent f11074b707
commit 230d7529b2
2 changed files with 20 additions and 5 deletions

3
.gitignore vendored
View File

@ -1 +1,2 @@
/grafanauth
/grafanauth
/result

View File

@ -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};