diff --git a/Dockerfile b/Dockerfile index 9554d69fff..b9f00ba1b1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,29 @@ -FROM haskell:8.10.4 AS build-stage -# if you encounter "version `GLIBC_2.28' not found" error when running -# chat client executable, build with the following base image instead: -# FROM haskell:8.10.4-stretch AS build-stage +FROM ubuntu:focal AS build + +# Install curl and simplex-chat-related dependencies +RUN apt-get update && apt-get install -y curl git build-essential libgmp3-dev zlib1g-dev + +# Install ghcup +RUN a=$(arch); curl https://downloads.haskell.org/~ghcup/$a-linux-ghcup -o /usr/bin/ghcup && \ + chmod +x /usr/bin/ghcup + +# Install ghc +RUN ghcup install ghc 8.10.7 +# Install cabal +RUN ghcup install cabal +# Set both as default +RUN ghcup set ghc 8.10.7 && \ + ghcup set cabal + COPY . /project WORKDIR /project -RUN stack install + +# Adjust PATH +ENV PATH="/root/.cabal/bin:/root/.ghcup/bin:$PATH" + +# Compile simplex-chat +RUN cabal update +RUN cabal install FROM scratch AS export-stage -COPY --from=build-stage /root/.local/bin/simplex-chat / +COPY --from=build /root/.cabal/bin/simplex-chat /