diff --git a/Makefile b/Makefile index 21f41da7dbc..140ea427053 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 diff --git a/changelog.d/5-internal/debugging-tools b/changelog.d/5-internal/debugging-tools new file mode 100644 index 00000000000..ffffed013ed --- /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 diff --git a/nix/wire-server.nix b/nix/wire-server.nix index 03005e5bc02..0f36d942b15 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 = ''