<div dir="ltr">Hi Mark,<div><br></div><div><br></div><div>That would be great, and I have tried that, but there is one issue that caused me to take the current approach instead.</div><div><br></div><div>The issue is that every change to<br><br>* Setup.hs</div><div>* simple-app.cabal</div><div>* stack.yaml<br><br>will cause the docker to consider the copy statement</div><div><br>> COPY LICENSE Setup.hs simple-app.cabal stack.yaml /app/<br><br>as a fresh checkpoint, and make the cache unusable. Since I've frequently changing stack.yaml, and app.cabal, this won't help me much.</div><div><br></div><div>Not sure if there's a way around that with this method.</div><div><br></div><div>Let me know if I've overlooked something with your approach!<br></div><div><br></div><div><br></div><div> - Lyndon</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Feb 25, 2016 at 9:04 AM, Mark Fine <span dir="ltr"><<a href="mailto:mark.fine@gmail.com" target="_blank">mark.fine@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">You can ask stack to build only dependencies and use that as a cache layer for docker. We do something like:<div><br></div><div><div><font face="monospace, monospace">FROM haskell:7.10</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">WORKDIR /app</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">COPY LICENSE Setup.hs simple-app.cabal stack.yaml /app/</font></div><div><font face="monospace, monospace">RUN stack setup</font></div><div><font face="monospace, monospace">RUN stack build simple-app --only-dependencies</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">COPY main /app/main</font></div><div><font face="monospace, monospace">COPY src /app/src</font></div><div><font face="monospace, monospace">RUN stack build simple-app --copy-bins</font></div></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="h5">On Wed, Feb 24, 2016 at 1:07 PM, Lyndon Maydwell <span dir="ltr"><<a href="mailto:maydwell@gmail.com" target="_blank">maydwell@gmail.com</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div dir="ltr">Hi Beginners,<div><br></div><div><br></div><div>I'm finally getting my hands dirty with Stack, and am using it in conjunction with Docker, but not with the built-in docker functionality.</div><div><br></div><div>My Dockerfile is constructed so that it first installs a whole bunch of dependencies globally, like so:</div><div><br></div><div>...</div><div>RUN stack install HUnit<br></div><div>...</div><div><br></div><div>Then after that, installs the project:</div><div><br></div><div>...</div><div><div>COPY . /app</div><div>WORKDIR /app</div><div>RUN stack install</div></div><div>...</div><div><br></div><div>This means that on repeated docker builds the app build and install time should be limited to just the application itself, because the dependency builds were cached. Which is great! However, I'm currently generating the list of dependencies just by looking at the output of the stack build of the app, and this displays everything as a flat list.</div><div><br></div><div>I'd like to see some kind of tree instead, so that when I pre-install the dependencies, I can specify a minimal list, rather than a whole slew of dependencies that would be pulled in transitively anyway.</div><div><br></div><div>Is there an easy way to do this?</div><div><br></div><div><br></div><div>Regards,</div><div><br></div><div> - Lyndon</div><div><br></div></div>
<br></div></div>_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org" target="_blank">Beginners@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners</a><br>
<br></blockquote></div><br></div>
<br>_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org">Beginners@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners</a><br>
<br></blockquote></div><br></div>