Hi,
I recently started using dockerTools.buildImage for a nodejs based project. It's working
fine but I am hitting a mental block trying to introduce layers - I don't want to always push
around node_modules.
My current setup is something like the following:
# default.nix
dockerImage = with pkgs; dockerTools.buildImage {
name = "foo";
contents = [ nodejsApp ];
config = {
Cmd = [ "${nodejs-6_x}/bin/node" "${nodejsApp}/index.js" ];
WorkingDir = "${nodejsApp}"
};
};
# nodejsApp.nix
stdenv.mkDerivation {
name = "nodejsApp";
src = "">
buildInputs = [ assets nodeModules ];
installPhase = ''
mkdir -p $out
ln -s ${nodeModules}/node_modules $out/node_modules
ln -s ${assets} $out/assets
...
'';
}
So basically I have a derivation for my app and I symlink in the node_modules. Now if I want to avoid pushing
the node_modules to my docker registry if they are unchanged I would have to create a docker image that contains
only the node_modules and specify that docker image as `fromImage` argument in my buildImage call I assume?
I'm just not quite sure to make it all fit together. Maybe someone could help me out a bit?
Thanks in advance!
best regards,
Tobi
_______________________________________________ nix-dev mailing list [email protected] http://lists.science.uu.nl/mailman/listinfo/nix-dev
- [Nix-dev] Question about dockerTools layering Tobias Pflug
- Re: [Nix-dev] Question about dockerTools layering Luca Bruno
- Re: [Nix-dev] Question about dockerTools layering Tobias Pflug
- Re: [Nix-dev] Question about dockerTools layering Tobias Pflug
