From 61d4d578e007887a2b0e771446173a31e1dd7587 Mon Sep 17 00:00:00 2001 From: jschaul Date: Tue, 8 Nov 2022 12:37:53 +0100 Subject: [PATCH 1/3] Add debugtools to wire-server images --- nix/wire-server.nix | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/nix/wire-server.nix b/nix/wire-server.nix index 03005e5bc0..0f36d942b1 100644 --- a/nix/wire-server.nix +++ b/nix/wire-server.nix @@ -194,6 +194,20 @@ let lib = pkgs.lib; galley-integration= [pkgs.mls-test-cli]; }; + # useful to poke around a container during a 'kubectl exec' + debugUtils = with pkgs; [ + bashInteractive + gnugrep + coreutils + dig + curl + less + gnutar + gzip + openssl + which + ]; + images = localMods@{enableOptimization, enableDocs, enableTests}: attrsets.mapAttrs (execName: drv: pkgs.dockerTools.streamLayeredImage { @@ -202,12 +216,10 @@ let lib = pkgs.lib; contents = [ pkgs.cacert pkgs.iana-etc - pkgs.coreutils - pkgs.bashInteractive pkgs.dumb-init drv tmpDir - ] ++ pkgs.lib.optionals (builtins.hasAttr execName extraContents) (builtins.getAttr execName extraContents); + ] ++ debugUtils ++ pkgs.lib.optionals (builtins.hasAttr execName extraContents) (builtins.getAttr execName extraContents); # Any mkdir running in this step won't actually make it to the image, # hence we use the tmpDir derivation in the contents fakeRootCommands = '' From 57f23173880446c9b9144a01dadce94536bf5964 Mon Sep 17 00:00:00 2001 From: jschaul Date: Mon, 7 Nov 2022 16:38:08 +0100 Subject: [PATCH 2/3] changelog --- changelog.d/5-internal/debugging-tools | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/5-internal/debugging-tools diff --git a/changelog.d/5-internal/debugging-tools b/changelog.d/5-internal/debugging-tools new file mode 100644 index 0000000000..ffffed013e --- /dev/null +++ b/changelog.d/5-internal/debugging-tools @@ -0,0 +1 @@ +Nix-created docker images: add some debugging tools in the containers, and add 'make build-image-' for convenience From 87b769e181da3284d2efd44cef81a5a597ee0be3 Mon Sep 17 00:00:00 2001 From: jschaul Date: Mon, 7 Nov 2022 16:39:30 +0100 Subject: [PATCH 3/3] convenience makefile target for local image building --- Makefile | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Makefile b/Makefile index 21f41da7db..140ea42705 100644 --- a/Makefile +++ b/Makefile @@ -178,6 +178,16 @@ shellcheck: ################################# ## docker targets +.PHONY: build-image-% +build-image-%: + nix-build ./nix -A wireServer.imagesNoDocs.$(*) && \ + ./result | docker load | tee /tmp/imageName-$(*) && \ + imageName=$$(grep quay.io /tmp/imageName-$(*) | awk '{print $$3}') && \ + echo 'You can run your image locally using' && \ + echo " docker run -it --entrypoint bash $$imageName" && \ + echo 'or upload it using' && \ + echo " docker push $$imageName" + .PHONY: upload-images upload-images: ./hack/bin/upload-images.sh imagesNoDocs