haskell/stack 的最新 (lts-13.0) 最小基础 docker 图像?

Up to date (lts-13.0) minimal base docker image for haskell/stack?

我想在 docker 上部署我的 haskell 应用程序,我发现基础映像 fco/stack-build 需要 9GB!你知道比那个更小的基本图像吗??

stack-build 这么大,因为它包含了 Stackage 上 所有 包所需的系统依赖。

我正在使用以下基础映像进行构建和部署:

FROM ubuntu:18.04

RUN apt-get update

# Build dependencies
RUN apt-get install --assume-yes curl
RUN curl -sSL https://get.haskellstack.org/ | sh
RUN apt-get install --assume-yes libtinfo-dev

# Without this haddock crashes for modules containing
# non-ASCII characters.
ENV LANG C.UTF-8

如果您只想在运行时使用图像,那么它并不是最小的,因为在这种情况下您不需要堆栈。

首先,该映像可能只需要 构建 可执行文件,一旦构建完成,您可以使用多阶段 docker 构建或直接复制可执行文件更苗条的形象。


docker文件可在此处获得:https://github.com/commercialhaskell/stack/blob/master/etc/dockerfiles/stack-build/lts-13.0/Dockerfile

您可以删除这些命令(它们加起来可能占了大部分大小):

# Use Stackage's debian-bootstrap.sh script to install system libraries and
# tools required to build any Stackage package.
#

RUN apt-get update && \
    apt-get install -y wget && \
    wget -qO- https://raw.githubusercontent.com/fpco/stackage/$BOOTSTRAP_COMMIT/debian-bootstrap.sh | bash && \
    rm -rf /var/lib/apt/lists/*