-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.template
47 lines (34 loc) · 1.61 KB
/
Dockerfile.template
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
FROM balenalib/%%BALENA_ARCH%%-debian:latest-build as build
WORKDIR /usr/src/balena-haskell-hello-world
SHELL ["/bin/bash", "-c"]
# Install ghcup using the official instructions
#RUN curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | BOOTSTRAP_HASKELL_NONINTERACTIVE=1 BOOTSTRAP_HASKELL_MINIMAL=1 bash
#
# Alas, the installer script runs `ghcup update` regardless of the parameters we supply,
# so we can't pin to a known good version (and 0.1.18.0 is known bad:
# https://gitlab.haskell.org/haskell/ghcup-hs/-/issues/405 ).
# But the download logic is too good to give up, so we've included the version of the
# script at the revision before 0.1.18.0, and then strip the upgrade command out of it here:
COPY bootstrap-haskell-60299b6b ./
RUN grep -vw 'eghcup upgrade' bootstrap-haskell-60299b6b \
| BOOTSTRAP_HASKELL_NONINTERACTIVE=1 BOOTSTRAP_HASKELL_MINIMAL=1 bash
# Add ghcup bin PATH explicitly, to avoid `source /root/.ghcup/env` before every command.
ENV PATH=${PATH}:/root/.ghcup/bin
# Install prerequisites
RUN install_packages llvm libnuma-dev libgmp3-dev
# install GHC and stack
ARG GHC_VER=8.10.7
ARG STACK_VER=2.7.5
RUN ghcup install ghc ${GHC_VER} && ghcup set ghc ${GHC_VER} && \
ghcup install stack ${STACK_VER} && ghcup set stack ${STACK_VER}
COPY *.cabal *.yaml ./
# Install dependencies for the stack project
RUN stack build --only-dependencies
COPY src ./src
RUN stack install
FROM balenalib/%%BALENA_ARCH%%-debian:latest-run
WORKDIR /usr/
COPY --from=build /root/.local/bin/balena-haskell-hello-world ./
COPY log ./log
COPY views ./views
CMD [ "./balena-haskell-hello-world", "-p", "80" ]