Dockerfile for Yesod

Greetings, all I'm brand new to Docker, and struggled to find resources specific to Yesod. So, once I managed to piece together a Dockerfile, I decided to share it. Hope it helps someone. The Dockerfile is pasted at the bottom. It can be used by dropping it in your Yesod application directory, and replacing "app" with the name of your app. If you're new to Docker like I was, cd to your Yesod app dir, and run $ docker build --tag app-image . $ docker run -d -p 3000:3000 app-image to get started. Your web app should now be available at http://localhost:3000 NB: The approot setting can make a profound and confusing difference if it is mis-configured. I recommend temporarily setting approot to "" so that it will use absolute (site-relative) urls instead of fully specified ones. Happy Holidays, Jon Dockerfile ----------- FROM haskell:7.8 RUN cabal update RUN apt-get update && apt-get install -y libpq5 libpq-dev ADD ./app.cabal /opt/app/app.cabal WORKDIR /opt/app RUN cabal sandbox init RUN cabal install --only-dependencies --max-backjumps=-1 --reorder-goals -j ADD . /opt/app RUN cabal build RUN dist/build/db-import/db-import ENV PATH /opt/app/.cabal-sandbox/bin:$PATH EXPOSE 3000 CMD ["/opt/app/dist/build/app/app", "production", "-p", "3000"]
participants (1)
-
Jonathan Paugh