Yesod无法在Docker上运行

ckx4rj1h  于 5个月前  发布在  Docker
关注(0)|答案(2)|浏览(56)

我尝试在docker上根据the docs构建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
093gszye

093gszye1#

你要找的线是

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,并导致this StackOverflow answer。所以尝试将en_US.UTF-8 UTF-8行附加到Docker镜像中的/etc/locale.gen文件。

svujldwt

svujldwt2#

这个答案主要是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

字符串
它用this additional answer聚合了提到的引用。

相关问题