Docker + Yesod Linking Failure

99 views Asked by At

I'm trying to make a Dockerized Yesod application, and I've initialized the Yesod project under the directory ./my-app. My Dockerfile is as follows:

FROM haskell:7.8

RUN apt-get update && apt-get install -y libpq5 libpq-dev
RUN cabal update

ADD my-app /opt/my-app

WORKDIR /opt/my-app

RUN cabal sandbox delete
RUN cabal sandbox init
RUN cabal install -j --only-dependencies
RUN cabal build

RUN dist/build/db-import/db-import

EXPOSE 3000

CMD ["dist/build/my-app/my-app", "production", "-p", "3000"]

When I actually go to run docker, it's able to build all the dependencies, but I get a linker error:

/opt/my-app/.cabal-sandbox/lib/x86_64-linux-ghc-7.8.4/cryptonite-0.3/libHScryptonite-0.3.a(generic.o):(.data+0x0): multiple definition of `gmtab'
/opt/my-app/.cabal-sandbox/lib/x86_64-linux-ghc-7.8.4/cipher-aes-0.2.10/libHScipher-aes-0.2.10.a(aes_generic.o):(.data+0x0): first defined here
collect2: error: ld returned 1 exit status

I'm not entirely sure what to do here, because I've tried this with haskell:latest and haskell:7.10 but I still end up with the same error. I'm not sure whether it's the fact that the specific container OS is Ubuntu or not. I'd love to hear suggestions on the matter.

Thanks!

1

There are 1 answers

0
arun1997 On

As @MichaelSnoyman stated, fiddling with stackage and changing the cabal file dependency for yesod-static to == 1.5.0 got the container to build.