-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathold1Dockerfile
47 lines (36 loc) · 1.45 KB
/
old1Dockerfile
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
# Loosely based on https://www.fpcomplete.com/blog/2017/12/building-haskell-apps-with-docker
FROM haskell:8.10 as dependencies
RUN mkdir /opt/build
WORKDIR /opt/build
# GHC dynamically links its compilation targets to lib gmp
# RUN apt-get update \
# && apt-get download libgmp10
# RUN mv libgmp*.deb libgmp.deb
# Docker build should not use cached layer if any of these is modified
COPY stack.yaml package.yaml stack.yaml.lock /opt/build/
RUN stack build --system-ghc --dependencies-only
# -------------------------------------------------------------------------------------------
FROM haskell:8.10 as build
# Copy compiled dependencies from previous stage
COPY --from=rottensunday/bot-v1:depends /root/.stack /root/.stack
COPY . /opt/build/
WORKDIR /opt/build
RUN stack build
RUN mv "$(stack path --local-install-root --system-ghc)/bin" /opt/build/bin
COPY bot.db /opt/build/bin
# -------------------------------------------------------------------------------------------
# Base image for stack build so compiled artifact from previous
# stage should run
FROM debian:latest as app
RUN /bin/sh -c 'apt-get update && \
apt-get install -y --no-install-recommends \
ca-certificates && \
rm -rf /var/lib/apt/lists/*'
RUN mkdir -p /opt/app
WORKDIR /opt/app
# Install lib gmp
# COPY --from=dependencies /opt/build/libgmp.deb /tmp
# RUN dpkg -i /tmp/libgmp.deb && rm /tmp/libgmp.deb
COPY --from=build /opt/build/bin .
# EXPOSE 8080
CMD ["/opt/app/discord-bot-v1-exe"]