Skip to content

Commit

Permalink
fix docker build by using debian with stack installed instead of alpi…
Browse files Browse the repository at this point in the history
…ne. static binary flags remove from stack calls
  • Loading branch information
aviaviavi committed Nov 25, 2018
1 parent 82467ae commit a8b73a7
Showing 1 changed file with 19 additions and 9 deletions.
28 changes: 19 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,26 +1,36 @@
FROM haskell:8.4 as build-env

WORKDIR /app
WORKDIR /toodles-app

RUN stack update

COPY toodles.cabal /app
COPY stack.yaml /app
COPY package.yaml /toodles-app/
COPY stack.yaml /toodles-app/
COPY app/ /toodles-app/app
COPY src/ /toodles-app/src
COPY test/ /toodles-app/test
COPY web/ /toodles-app/web
COPY README.md /toodles-app/

RUN stack install --only-dependencies

COPY . /app
RUN stack install

RUN stack install --ghc-options '-optl-static'
FROM debian:stretch

FROM alpine:latest

WORKDIR /app
COPY --from=build-env /app .
WORKDIR /toodles-app
COPY --from=build-env /toodles-app .
COPY --from=build-env /root/.local/bin/toodles /usr/local/bin/

VOLUME /repo

EXPOSE 9001

# Due to issues described in https://github.com/aviaviavi/toodles/issues/54, we
# have to install stack to make the binary from the previous step work in our
# container
RUN apt-get update
RUN apt-get install -y wget
RUN wget -qO- https://get.haskellstack.org/ | sh

CMD ["toodles","-d","/repo/"]

0 comments on commit a8b73a7

Please sign in to comment.