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";
|
||||
};
|
||||
service.image = mkOption {
|
||||
type = str;
|
||||
type = nullOr str;
|
||||
default = null;
|
||||
description = serviceRef "image";
|
||||
};
|
||||
service.command = mkOption {
|
||||
@ -328,8 +329,9 @@ in
|
||||
volumes
|
||||
environment
|
||||
sysctls
|
||||
image
|
||||
;
|
||||
} // lib.optionalAttrs (config.service.image != null) {
|
||||
inherit (config.service) image;
|
||||
} // lib.optionalAttrs (config.service.build.context != null) {
|
||||
inherit (config.service) build;
|
||||
} // lib.optionalAttrs (cap_add != []) {
|
||||
|
@ -163,17 +163,19 @@ in
|
||||
'';
|
||||
};
|
||||
};
|
||||
config = {
|
||||
config = lib.mkMerge [{
|
||||
build.image = builtImage;
|
||||
build.imageName = config.build.image.imageName;
|
||||
build.imageTag =
|
||||
if config.build.image.imageTag != ""
|
||||
then config.build.image.imageTag
|
||||
else lib.head (lib.strings.splitString "-" (baseNameOf config.build.image.outPath));
|
||||
|
||||
service.image = lib.mkDefault "${config.build.imageName}:${config.build.imageTag}";
|
||||
image.rawConfig.Cmd = config.image.command;
|
||||
|
||||
image.nixBuild = lib.mkDefault (priorityIsDefault options.service.image);
|
||||
};
|
||||
}
|
||||
( lib.mkIf (config.service.build.context == null)
|
||||
{
|
||||
service.image = lib.mkDefault "${config.build.imageName}:${config.build.imageTag}";
|
||||
})
|
||||
];
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user