forked from hasufell/stack2cabal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
34 lines (25 loc) · 914 Bytes
/
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
FROM alpine:3.12 as builder
ARG GHC=8.10.7
# install ghc and stack
RUN \
apk add --no-cache git curl gcc g++ gmp-dev ncurses-dev libffi-dev make xz tar perl && \
apk add --no-cache zlib zlib-dev zlib-static ncurses-static && \
curl https://downloads.haskell.org/~ghcup/x86_64-linux-ghcup > /usr/bin/ghcup && \
chmod +x /usr/bin/ghcup && \
ghcup -v install ghc --set ${GHC} && \
ghcup -v install cabal
COPY . /app
# install app
RUN \
cd /app && \
mkdir -p ~/.local/bin && \
export PATH="/root/.ghcup/bin:$PATH" && \
cabal update && \
cabal install --installdir="$HOME/.local/bin" --install-method=copy --overwrite-policy=always --ghc-options='-split-sections -optl-static'
# strip binary
RUN strip -s /root/.local/bin/stack2cabal
FROM alpine:3.12
COPY --from=builder /root/.local/bin/stack2cabal /usr/bin/stack2cabal
RUN \
apk add --no-cache git
ENTRYPOINT ["/usr/bin/stack2cabal"]