What I'm trying to achieve
I want to develop a personal website with Haskell and Yesod. My previous web work is mainly in Python. I use Docker so I can deploy easily on Amazon Web Services once everything is finished. I do all my development in containers - so no software gets installed directly on my machine apart from utilities like vim and git - then just deploy the container. I want to do the same for this site.
What I've tried
My Dockerfile currently looks like this:
FROM haskell:latest
MAINTAINER Garry Cairns
ENV REFRESHED_AT 2015-03-19
# create a haskell user to run our programs
# ADD must be after chown see http://stackoverflow.com/a/26145444/1281947
RUN ["groupadd", "haskell"]
RUN ["useradd", "haskell", "-s", "/bin/bash", "-m", "-g", "haskell", "-G", "haskell"]
ENV HOME /home/haskell
RUN ["mkdir", "/home/haskell", "-p"]
WORKDIR /home/haskell
RUN ["chown", "-R", "haskell:haskell", "/home/haskell"]
ADD ./ /home/haskell
# install yesod
RUN ["apt-get", "install", "-y", "wget"]
RUN ["wget", "http://www.stackage.org/lts/cabal.config"]
RUN ["cabal", "update"]
RUN ["cabal", "install", "yesod"]
# uncomment the line below to use container as a non-root user
# USER haskell:haskell
The instructions under the install yesod comment are from the yesod quick start guide. The container builds but, at the cabal update
step while doing so, I see a warning saying:
Config file path source is default config file.
Config file /home/haskell/.cabal/config not found.
Writing default configuration to /home/haskell/.cabal/config
Downloading the latest package list from hackage.haskell.org
Note: there is a new version of cabal-install available.
To upgrade, run: cabal install cabal-install
This may or may not have something to do with the errors that follow.
I run a shell session on this container with sudo docker run -itv /home/garry/projects/personal/api/:/home/haskell garrycairns/haskell /bin/bash
and try yesod init
, which tells me it can't find the yesod
command. Running ghci doesn't let me import Yesod
either.
The result is the same whether I cabal install yesod or yesod-bin.
I've also tried running as the haskell user (see my Dockerfile) with the same result.
Expected result
Running yesod init
should scaffold my application as described in the quick start guide.
Actual result
The yesod commands are not available in my container.
What I'm asking
How do I set up a Docker container that will let me run yesod init
and, later, yesod devel
?