我尝试使用此Dockerfile在Docker容器中编译程序:
FROM haskell:8.4
COPY stack.yaml /opt/waziup/stack.yaml
COPY foo.cabal /opt/waziup/foo.cabal
WORKDIR /opt/waziup
RUN stack setup
RUN stack install --only-dependencies
COPY . /opt/waziup
RUN stack install
我的stack.yaml文件是这样的:
resolver: lts-12.20
extra-deps:
- servant-flatten-0.2
packages:
- '.'
当我键入stack install
时,此方法有效。但是,当我尝试编译docker时:
$ docker build .
servant-flatten-0.2: download
servant-flatten-0.2: configure
servant-flatten-0.2: build
servant-flatten-0.2: copy/register
...
/opt/waziup/src/Foo.hs:37:1: error:
Could not find module ‘Servant.API.Flatten’
There are files missing in the ‘servant-flatten-0.2’ package,
try running 'ghc-pkg check'.
Use -v to see a list of the files searched for.
有什么主意吗? Extra-deps软件包会发生什么?