hello-world icon indicating copy to clipboard operation
hello-world copied to clipboard

stack can build docker images

Open ketzacoatl opened this issue 7 years ago • 1 comments

Awesome project! You may already know this, so feel free to ignore me if so. In case this is news, I thought you might find it helpful to know that stack can build docker images for you, and it's quite nice. For example:

image:
  containers:
  - name: foobar
    base: alpine:latest

ketzacoatl avatar Mar 06 '18 16:03 ketzacoatl

@ketzacoatl I initially didn't know of that feature. However upon closer inspection I ran into some issues:

  • we won't be able to just directly use alpine:latest as the runtime image; we still have some system deps for a pure Haskell app: namely gmp and ffi.
  • so say we decide to write a docker file for the runtime runner that stack.yaml will use, we still have to build it first (manually) and it will only work for a pure Haskell app.
  • app specific runtime docker file is probably inevitable as we may want to add some form of monitoring, log collection, etc. and unlike the builder, we can't just bundle the sum of all deps in a "generic" runner image (since it might defeat the goal of ultra-light image).
  • if we have an app specific docker file anyway, then we're (almost) back to the current project structure. we only save the single COPY command.

I'd say image config works if you can somehow come up with a generic-ish runner image that fits all of your needs across many apps. See branch stack-docker-image if you'd like to continue playing with it.

naushadh avatar Mar 11 '18 22:03 naushadh