skip to Main Content

I’m trying to build yesod according to the docs on docker:

# 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

I get until the next to last step, but then fail:

> 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

Here is the error message:

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

Any ideas how can I fix this?


EDIT

  • I could not find anything relevant in the (huge) logs
  • Here are the log messages: google doc

2

Answers


  1. Chosen as BEST ANSWER

    This answer is mostly an addendum for mb21's answer with the complete 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
    

    It aggregates the mentioned reference with this additional answer.


  2. The line you’re looking for is

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

    Googling "docker" hGetContents: invalid argument (invalid byte sequence) tells us that this means the source code file is not UTF-8 and leads to this StackOverflow answer. So try appending the line en_US.UTF-8 UTF-8 to the /etc/locale.gen file in your docker image.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search