> On 23 Sep 2016, at 22:01, Luca Bruno <[email protected]> wrote: > > Yes, you can create an image with only node_modules and then layer on top of > it another image with fromImage. > > You can make the node_modules symlink in the base image. Then only update > assets in the upper image. >
I guess this is the part where I am somewhat confused - when those are separated how do I create the symlink. Should i be creating a symlink to some absolute path in the node_modules image and then symlink to that absolute path in the other one? I feel silly for asking but i do have some mental block on that ;) >> On Fri, Sep 23, 2016 at 8:38 PM, Tobias Pflug <[email protected]> wrote: >> 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 >> > > > > -- > NixOS Linux
_______________________________________________ nix-dev mailing list [email protected] http://lists.science.uu.nl/mailman/listinfo/nix-dev
