mirror of
https://github.com/hercules-ci/arion.git
synced 2024-11-22 15:24:26 +03:00
fix: services.<name>.service.build.context
One could declare it, but it was unceremoniously ignored. A "localhost/" image was created with pretty much nothing in it and it couldn't be launched. The cause was services.<name>.service.image being always set and subsequently thugs services.<name>.image.nixBuild being truthy. That would build an image and write the services.<name>.image field in the docker-compose.json. It leads to the build.context being ignored and the service failing. This was solved by only writing services.<name>.service.image when services.<name>.service.build.context is not set. services.<name>.image.nixBuild is additionally set to false when the context is set. Related to #208
This commit is contained in:
parent
a8d9725e6c
commit
638c4b8e55
@ -86,7 +86,8 @@ in
|
|||||||
description = serviceRef "environment";
|
description = serviceRef "environment";
|
||||||
};
|
};
|
||||||
service.image = mkOption {
|
service.image = mkOption {
|
||||||
type = str;
|
type = nullOr str;
|
||||||
|
default = null;
|
||||||
description = serviceRef "image";
|
description = serviceRef "image";
|
||||||
};
|
};
|
||||||
service.command = mkOption {
|
service.command = mkOption {
|
||||||
@ -328,8 +329,9 @@ in
|
|||||||
volumes
|
volumes
|
||||||
environment
|
environment
|
||||||
sysctls
|
sysctls
|
||||||
image
|
|
||||||
;
|
;
|
||||||
|
} // lib.optionalAttrs (config.service.image != null) {
|
||||||
|
inherit (config.service) image;
|
||||||
} // lib.optionalAttrs (config.service.build.context != null) {
|
} // lib.optionalAttrs (config.service.build.context != null) {
|
||||||
inherit (config.service) build;
|
inherit (config.service) build;
|
||||||
} // lib.optionalAttrs (cap_add != []) {
|
} // lib.optionalAttrs (cap_add != []) {
|
||||||
|
@ -163,17 +163,19 @@ in
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
config = {
|
config = lib.mkMerge [{
|
||||||
build.image = builtImage;
|
build.image = builtImage;
|
||||||
build.imageName = config.build.image.imageName;
|
build.imageName = config.build.image.imageName;
|
||||||
build.imageTag =
|
build.imageTag =
|
||||||
if config.build.image.imageTag != ""
|
if config.build.image.imageTag != ""
|
||||||
then config.build.image.imageTag
|
then config.build.image.imageTag
|
||||||
else lib.head (lib.strings.splitString "-" (baseNameOf config.build.image.outPath));
|
else lib.head (lib.strings.splitString "-" (baseNameOf config.build.image.outPath));
|
||||||
|
image.rawConfig.Cmd = config.image.command;
|
||||||
service.image = lib.mkDefault "${config.build.imageName}:${config.build.imageTag}";
|
image.nixBuild = lib.mkDefault (priorityIsDefault options.service.image);
|
||||||
image.rawConfig.Cmd = config.image.command;
|
}
|
||||||
|
( lib.mkIf (config.service.build.context == null)
|
||||||
image.nixBuild = lib.mkDefault (priorityIsDefault options.service.image);
|
{
|
||||||
};
|
service.image = lib.mkDefault "${config.build.imageName}:${config.build.imageTag}";
|
||||||
|
})
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ in
|
|||||||
enable = true;
|
enable = true;
|
||||||
dockerSocket.enable = true;
|
dockerSocket.enable = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
# no caches, because no internet
|
# no caches, because no internet
|
||||||
nix.settings.substituters = lib.mkForce [];
|
nix.settings.substituters = lib.mkForce [];
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user