hello-world
hello-world copied to clipboard
stack can build docker images
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 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:latestas the runtime image; we still have some system deps for a pure Haskell app: namelygmpandffi. - so say we decide to write a docker file for the runtime
runnerthatstack.yamlwill 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.