Yesod 无法在 docker 上运行

问题描述 投票:0回答:2

我正在尝试根据docker上的

文档
构建yesod

# Dockerfile
FROM ubuntu:22.04
RUN apt-get update
RUN apt-get install curl -y
RUN curl -sSL https://get.haskellstack.org/ | sh
RUN stack new my-project yesodweb/sqlite
RUN cd my-project && stack install yesod-bin --install-ghc
RUN cd my-project && stack build

我直到最后一步,但失败了:

> docker build --tag host_yesod --file Dockerfile .
 => [1/7] FROM docker.io/library/ubuntu:22.04@sha256:6042500cf4b44b  0.0s
 => CACHED [2/7] RUN apt-get update 0.0s
 => CACHED [3/7] RUN apt-get install curl -y 0.0s
 => CACHED [4/7] RUN curl -sSL https://get.haskellstack.org/ | sh 0.0s
 => CACHED [5/7] RUN stack new my-project yesodweb/sqlite 0.0s
 => CACHED [6/7] RUN cd my-project && stack install yesod-bin --install-ghc
 => ERROR [7/7] RUN cd my-project && stack build 100.7s

这是错误消息:

100.6 Error: [S-7282]
100.6        Stack failed to execute the build plan.
100.6
100.6        While executing the build plan, Stack encountered the error:
100.6
100.6        [S-7011]
100.6        While building package language-javascript-0.7.1.0 (scroll up to its section to see the
100.6        error) using:
100.6        /root/.stack/setup-exe-cache/x86_64-linux-tinfo6/Cabal-simple_6HauvNHV_3.6.3.0_ghc-9.2.8 --verbose=1 --builddir=.stack-work/dist/x86_64-linux-tinfo6/ghc-9.2.8 build --ghc-options ""
100.6        Process exited with code: ExitFailure 1

有什么想法可以解决这个问题吗?


编辑

  • 我在(巨大的)日志中找不到任何相关内容
  • 以下是日志消息:google doc
docker haskell yesod haskell-stack
2个回答
1
投票

您要找的线路是

92.67 language-javascript
  > happy: src/Language/JavaScript/Parser/Grammar7.y:
  hGetContents: invalid argument (invalid byte sequence)

谷歌搜索

"docker" hGetContents: invalid argument (invalid byte sequence)
告诉我们,这意味着源代码文件不是UTF-8,并导致这个StackOverflow答案。因此,请尝试将行
en_US.UTF-8 UTF-8
附加到 docker 映像中的
/etc/locale.gen
文件中。


0
投票

这个答案主要是 mb21's 答案的附录以及完整的 Dockerfile:

FROM ubuntu:22.04
RUN apt-get update
RUN apt-get install curl -y
RUN curl -sSL https://get.haskellstack.org/ | sh
RUN stack new my-project yesodweb/sqlite
RUN cd my-project && stack install yesod-bin --install-ghc
RUN apt-get install -y locales
RUN locale-gen en_US.UTF-8
RUN cd my-project && export LANG=en_US.UTF8 && stack build

它将提到的参考文献与这个附加答案聚合在一起。

© www.soinside.com 2019 - 2024. All rights reserved.