feat(sgx): try to reduce the docker layers

Signed-off-by: Harald Hoyer <harald@matterlabs.dev>
This commit is contained in:
Harald Hoyer 2025-01-27 11:17:13 +01:00
parent 788ff52330
commit 2821ae4d91
Signed by: harald
GPG key ID: F519A1143B3FBE32

View file

@ -97,9 +97,6 @@ let
tomlFormat = pkgs.formats.toml { }; tomlFormat = pkgs.formats.toml { };
manifestFile = tomlFormat.generate "${name}.manifest.toml" mergedManifest; manifestFile = tomlFormat.generate "${name}.manifest.toml" mergedManifest;
contents = pkgs.buildEnv {
name = "image-root-${appName}";
paths = with pkgs.dockerTools; with nixsgx;[ paths = with pkgs.dockerTools; with nixsgx;[
openssl.out openssl.out
curl.out curl.out
@ -131,23 +128,27 @@ let
eval "${extraPostBuild}" eval "${extraPostBuild}"
) )
''; '';
contents = pkgs.buildEnv {
name = "image-root-${appName}";
inherit paths pathsToLink postBuild;
}; };
extendedContents = pkgs.buildEnv { extendedContents = pkgs.buildEnv {
name = "extended-root-${appName}"; name = "extended-root-${appName}";
paths = with pkgs.dockerTools; with nixsgx;[ paths = paths ++ (with pkgs.dockerTools; with nixsgx;[
coreutils coreutils
restart-aesmd restart-aesmd
sgx-psw sgx-psw
usrBinEnv usrBinEnv
binSh binSh
fakeNss fakeNss
] ++ extendedPackages; ]) ++ extendedPackages;
pathsToLink = [ "/bin" "/lib" "/etc" "/share" ]; pathsToLink = pathsToLink ++ [ "/bin" "/lib" "/etc" "/share" ];
postBuild = postBuild = postBuild + (
if sgx_default_qcnl_conf != null then '' if sgx_default_qcnl_conf != null then ''
( (
set -e set -e
@ -155,7 +156,8 @@ let
rm -f $out/etc/sgx_default_qcnl.conf rm -f $out/etc/sgx_default_qcnl.conf
ln -s ${sgx_default_qcnl_conf} $out/etc/sgx_default_qcnl.conf ln -s ${sgx_default_qcnl_conf} $out/etc/sgx_default_qcnl.conf
) )
'' else null; '' else ""
);
}; };
config = { config = {
@ -201,7 +203,6 @@ let
name = "${name}-manifest-${appName}"; name = "${name}-manifest-${appName}";
inherit tag; inherit tag;
inherit contents; inherit contents;
inherit fromImage;
inherit maxLayers; inherit maxLayers;
includeStorePaths = false; includeStorePaths = false;