-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
51 lines (31 loc) · 1.29 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# See: https://www.fpcomplete.com/blog/2017/12/building-haskell-apps-with-docker
# See: https://medium.com/permutive/optimized-docker-builds-for-haskell-76a9808eb10b
# ----------------------------------------------------------------------------------
# Building Dependencies
FROM fpco/stack-build:lts-13.22 as dependencies
RUN mkdir /opt/build
WORKDIR /opt/build
RUN apt-get update \
&& apt-get download libgmp10
RUN mv libgmp*.deb libgmp.deb
COPY stack.yaml package.yaml /opt/build/
RUN stack build --system-ghc --dependencies-only
# ----------------------------------------------------------------------------------
# Building the project
FROM fpco/stack-build:lts-13.22 as build
COPY --from=dependencies /root/.stack /root/.stack
COPY . /opt/build/
WORKDIR /opt/build
RUN stack build --system-ghc
RUN mv "$(stack path --local-install-root --system-ghc)/bin" /opt/build/bin
# ----------------------------------------------------------------------------------
# Running the project
FROM ubuntu:16.04 as app
RUN mkdir -p /opt/decompositiondiversity/
WORKDIR /opt/decompositiondiversity
COPY --from=dependencies /opt/build/libgmp.deb /tmp
RUN dpkg -i /tmp/libgmp.deb && rm /tmp/libgmp.deb
COPY --from=build /opt/build/bin .
RUN ls
EXPOSE 9999
CMD ["/opt/decompositiondiversity/Repl", "--json"]