Add option to build docker image

This commit adds dockerbuild to flakes.nix:

```
nix build .#headscale-docker
```

This uses the Nix infra to build and _does not_ use Dockerfile.

It currently works on Linux (no macOS)
This commit is contained in:
Kristoffer Dalby 2022-03-07 17:18:41 +00:00
parent 124d8a3424
commit a6570d33a6

View File

@ -84,6 +84,16 @@
buf
clang-tools # clang-format
];
# Add entry to build a docker image with headscale
# caveat: only works on Linux
headscale-docker = pkgs.dockerTools.buildLayeredImage {
name = "headscale";
tag = "latest";
contents = [ pkgs.${system}.headscale ];
config.Entrypoint = [ (pkgs.${system}.headscale + "/bin/headscale") ];
};
in
rec {
# `nix develop`
@ -92,6 +102,8 @@
# `nix build`
packages = with pkgs; {
inherit headscale;
inherit headscale-docker;
};
defaultPackage = pkgs.headscale;
@ -101,5 +113,6 @@
};
defaultApp = apps.headscale;
});
}