Construct the dev and prod containers directly in the set

This commit is contained in:
Omar Brikaa 2022-02-19 14:40:32 +02:00
parent a9952072c1
commit c2bc1ebf94
2 changed files with 13 additions and 14 deletions

View File

@ -6,17 +6,7 @@
let let
system = "x86_64-linux"; system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system}; pkgs = nixpkgs.legacyPackages.${system};
_nosocket = self.legacyPackages."${system}".nosocket; nosocket = self.legacyPackages."${system}".nosocket;
_devContainer = (import ./api {
inherit pkgs _nosocket;
nosocket = _nosocket;
appEnv = "dev";
}).container;
_prodContainer = (import ./api {
inherit pkgs _nosocket;
nosocket = _nosocket;
appEnv = "prod";
}).container;
args = { args = {
inherit pkgs; inherit pkgs;
piston = { piston = {
@ -81,7 +71,16 @@
piston = (import ./api { inherit pkgs nosocket; }).package; piston = (import ./api { inherit pkgs nosocket; }).package;
}; };
devContainer = _devContainer; containers = {
prodContainer = _prodContainer; dev = (import ./api {
inherit pkgs nosocket;
appEnv = "dev";
}).container;
prod = (import ./api {
inherit pkgs nosocket;
appEnv = "prod";
}).container;
};
}; };
} }

2
piston
View File

@ -13,7 +13,7 @@ SUBCOMMAND="$1"
shift shift
build_base() { build_base() {
container_flake_key=$([[ $1 == "dev" ]] && echo "devContainer" || echo "prodContainer") container_flake_key=$([[ $1 == "dev" ]] && echo "containers.dev" || echo "containers.prod")
CONTAINER_PATH="$(nix build ".#$container_flake_key" --no-link --json | jq '.[0].outputs.out' -r)" CONTAINER_PATH="$(nix build ".#$container_flake_key" --no-link --json | jq '.[0].outputs.out' -r)"
echo "The image archive was created at: $CONTAINER_PATH" echo "The image archive was created at: $CONTAINER_PATH"
docker load -i $CONTAINER_PATH || exit 1 docker load -i $CONTAINER_PATH || exit 1