FROM haskell:9.8.4

WORKDIR /opt/cryptoids

RUN cabal update

# Add just the .cabal file to capture dependencies
COPY ./cryptoids.cabal /opt/cryptoids/cryptoids.cabal

# Docker will cache this command as a layer, freeing us up to
# modify source code without re-installing dependencies
# (unless the .cabal file changes!)
RUN cabal build --only-dependencies -j4

# Add and Install Application Code
COPY . /opt/cryptoids
RUN cabal build