Closed aleeusgr closed 1 year ago
$ docker-compose build hello-postgresql
$ docker run --rm --interactive --tty thoughtbot/ghc
$ docker --version OK
[+] Building 0.0s (0/0)
extraGroups = [ "docker" ];
in configuration.nix
FROM haskell:8.10
RUN stack install --resolver lts-17.14 pandoc citeproc
ENTRYPOINT ["pandoc"]
FROM haskell:8.10
RUN cabal update && cabal install pandoc citeproc
ENTRYPOINT ["pandoc"]
Error: cabal
: There is no
For non-trivial projects you will also want a cabal.project file in the root directory of your project. This file lists the packages in your project and all other build configuration. See the Cabal user guide for full details.
https://github.com/ners/hello-haskell
✅ nix run
Next: search "dokerize nix" https://nix.dev/tutorials/building-and-running-docker-images
Nobbz on discord:
Why don't you use nix to build the container, rather than using nix in the container? Use dockerTools
https://www.fpcomplete.com/blog/2015/05/haskell-web-server-in-5mb/
This runs:
docker pull fpco/rdr2tls
docker run -i -t --rm -p 8080:8080 fpco/rdr2tls
test it : curl -v 'http://localhost:8080/remote/worker?pants=YES'
but rebuilding fails.
/bin/sh: stack: not found The command '/bin/sh -c stack setup' returned a non-zero code: 127
nix haskell hello -> simplest dockerfile
https://github.com/ners/hello-haskell
white_check_mark nix run
Next: search "dokerize nix"
And I have nix docker image
$ docker run f2b203482528
GHCi, version 8.10.7: https://www.haskell.org/ghc/ :? for help
Prelude> Leaving GHCi.
Step 4/4 : RUN cabal run
---> Running in 6c362e4ef754
Error: cabal: There is no
https://github.com/phadej/docker-haskell-example
Hello @phadej! I was looking for some multi-stage build Dockerfiles for Haskell projects and I happened upon this one, which has some great tips. I think one currently agreed-upon Docker best practice is missing, though, from your Dockerfile: don't run processes as root. It may be worth changing here if people are finding your blog-post and copying the code in there? I could probably submit a PR to this repo if you think it's worth it.
09:00 $ cabal run
cabal: Could not resolve dependencies:
[0] trying: docker-haskell-example-0 (user goal)
[1] trying: warp-3.2.27 (dependency of docker-haskell-example)
[2] trying: wai-3.2.2 (dependency of warp)
[3] trying: transformers-0.5.6.2/installed-0.5.6.2 (dependency of wai)
[4] next goal: vault (dependency of warp)
[4] rejecting: vault-0.3.1.2 (conflict: transformers =>base==4.15.1.0/installed-4.15.1.0, vault => base>=4.5 && <4.13)
09:00 $ docker run docker-haskell-example
docker-haskell-example: user error (PASSWORD not set)
Building docker container requires nix-build to complete:
https://github.com/SIDANWhatever/plutus-cborhex-automation/issues/18
Docs
Haskell
https://discourse.haskell.org/t/haskell-and-docker/499 https://docs.haskellstack.org/en/stable/docker_integration/ https://hub.docker.com/_/haskell https://github.com/haskell/docker-haskell
Docker
https://dockerlabs.collabnix.com/docker/cheatsheet/ https://docs.docker.com/develop/develop-images/baseimages/ https://docs.docker.com/engine/reference/builder/ https://docs.docker.com/develop/develop-images/dockerfile_best-practices/ https://thoughtbot.com/blog/easy-haskell-development-and-deployment-with-docker
Nix
https://nix.dev/tutorials/building-and-running-docker-images