Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker images: Add container utilities #2829

Merged
merged 3 commits into from
Nov 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions changelog.d/5-internal/debugging-tools
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Nix-created docker images: add some debugging tools in the containers, and add 'make build-image-<packagename>' for convenience
18 changes: 15 additions & 3 deletions nix/wire-server.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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 = ''
Expand Down