Skip to content

Commit

Permalink
Try and unminimize the Ubuntu Docker image
Browse files Browse the repository at this point in the history
  • Loading branch information
diamondburned committed Feb 9, 2024
1 parent 6fbea5e commit 2054684
Showing 1 changed file with 36 additions and 8 deletions.
44 changes: 36 additions & 8 deletions containers/cs306/test.nix
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,48 @@ in
arch = "x86_64";
};

unminifiedUbuntuImage = pkgs.dockerTools.buildImage {
name = "unminified-ubuntu";
tag = "latest";

fromImage = ubuntuImage;
fromImageName = null;
fromImageTag = "latest";

runAsRoot = ''
#!${pkgs.runtimeShell}
unminimize
apt update
apt install -y --no-install-recommends \
ca-certificates \
curl \
bash \
git
'';

config = {
Entrypoint = [ "/bin/bash" ];
};
};

cmdArgs = [];

# See https://nixos.org/manual/nixpkgs/stable/#ssec-pkgs-dockerTools-buildLayeredImage.
imageFile = pkgs.dockerTools.buildLayeredImage {
name = "experimental-discord-bot-image";
tag = "latest";
enableFakechroot = true;
fromImage = ubuntuImage;

fromImage = unminifiedUbuntuImage;
fromImageName = null;
fromImageTag = "latest";

contents = pkgs.writeShellScriptBin "experimental-discord-bot" ''
echo "Checking for Internet connectivity..."
wget --spider http://google.com
echo "Initializing Ubuntu..."
apt update
apt install -y git golang
echo "Dropping into a shell..."
exec /bin/sh
echo "Installing Go..."
apt install -y golang
echo "Downloading Discord bot..."
git clone https://libdb.so/arikawa
Expand All @@ -52,7 +76,10 @@ in
echo "Running the bot..."
exec ./commands-hybrid
'';
config.Cmd = [ "/bin/experimental-discord-bot" ] ++ cmdArgs;

config = {
Entrypoint = [ "/bin/experimental-discord-bot" ] ++ cmdArgs;
};
};
in
{
Expand All @@ -68,6 +95,7 @@ in
"127.0.0.1:48765:80"
];
image = "experimental-discord-bot-image:latest";

inherit imageFile;
};
};
Expand Down

0 comments on commit 2054684

Please sign in to comment.