mirror of
https://github.com/TECHNOFAB11/kubenix.git
synced 2025-12-12 08:00:06 +01:00
docs: cleanup, fix links, add comments
This commit is contained in:
parent
8d10d79cfe
commit
95504f4c3b
12 changed files with 65 additions and 82 deletions
|
|
@ -4,8 +4,8 @@ weight: 30
|
|||
|
||||
Instead of deploying a 3rd party image, we can build our own.
|
||||
|
||||
We rely on the upstream [`dockerTools`](https://github.com/NixOs/nixpkgs/tree/master/pkgs/built-support/docker) package here.
|
||||
Specifically, we can use the `buildImage` function to define our image:
|
||||
We rely on the upstream [`dockerTools`](https://nixos.org/manual/nixpkgs/stable/#sec-pkgs-dockerTools) package here.
|
||||
Specifically, we can use the `buildLayeredImage` function to define our image:
|
||||
|
||||
{{< source "image.nix" >}}
|
||||
|
||||
|
|
@ -60,7 +60,5 @@ Render the generated manifests again and see that it now refers to the newly bui
|
|||
Of course, to actually deploy, we need to push the image to our registry. The script defined at {{< option "docker.copyScript" >}} does just that.
|
||||
|
||||
```sh
|
||||
$(nix build -f . --json config.docker.copyScript | jq -r '.[].outputs.out')
|
||||
$(nix build -f . --print-out-paths config.docker.copyScript)
|
||||
```
|
||||
|
||||
<!-- TODO: can we make that `nix run -f . config.docker.copyScript` ? -->
|
||||
|
|
|
|||
|
|
@ -1,15 +1,10 @@
|
|||
{kubenix ? import ../../../..}:
|
||||
{ kubenix ? import ../../../.. }:
|
||||
kubenix.evalModules.${builtins.currentSystem} {
|
||||
module = {
|
||||
kubenix,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}: {
|
||||
imports = with kubenix.modules; [k8s docker];
|
||||
module = { kubenix, config, pkgs, ... }: {
|
||||
imports = with kubenix.modules; [ k8s docker ];
|
||||
docker = {
|
||||
registry.url = "docker.somewhere.io";
|
||||
images.example.image = pkgs.callPackage ./image.nix {};
|
||||
images.example.image = pkgs.callPackage ./image.nix { };
|
||||
};
|
||||
kubernetes.resources.pods.example.spec.containers = {
|
||||
custom.image = config.docker.images.example.path;
|
||||
|
|
|
|||
|
|
@ -1,10 +1,7 @@
|
|||
{
|
||||
dockerTools,
|
||||
nginx,
|
||||
}:
|
||||
{ dockerTools, nginx }:
|
||||
dockerTools.buildLayeredImage {
|
||||
name = "nginx";
|
||||
contents = [nginx];
|
||||
contents = [ nginx ];
|
||||
extraCommands = ''
|
||||
mkdir -p etc
|
||||
chmod u+w etc
|
||||
|
|
@ -12,9 +9,9 @@ dockerTools.buildLayeredImage {
|
|||
echo "nginx:x:1000:nginx" > etc/group
|
||||
'';
|
||||
config = {
|
||||
Cmd = ["nginx" "-c" "/etc/nginx/nginx.conf"];
|
||||
Cmd = [ "nginx" "-c" "/etc/nginx/nginx.conf" ];
|
||||
ExposedPorts = {
|
||||
"80/tcp" = {};
|
||||
"80/tcp" = { };
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue