mirror of
https://github.com/simplex-chat/simplexmq.git
synced 2026-03-30 16:26:02 +00:00
* add llvm to build stage running docker build on Apple Sillicon would result in this error: #14 49.39 <no location info>: error: #14 49.39 Warning: Couldn't figure out LLVM version! #14 49.39 Make sure you have installed LLVM between [9 and 13) I assume it can’t find llvm/clang? * install using unattended helper script the current haskell is hardcoded to x86, so switch to using haskell’s official helper script which supports arm also need to bump up setting the path, since ghcup is no longer in /usr/bin reference: https://www.haskell.org/ghcup/guide/#continuous-integration * add numa headers/libs docker build (specifically haskell install step) would fail with : #7 107.2 utils/ghc-cabal/dist-install/build/tmp/ghc-cabal: error while loading shared libraries: libnuma.so.1: cannot open shared object file: No such file or directory I think this is because numa isn’t installed on arm instances of focal by default, but it is in later versions anyway this fixes that * also add numa to final The image builds at this point! But it fails to boot on arm - again with a numa error. This fixes that. * don’t specify llvm version --------- Co-authored-by: +shyfire131 <shyfire131@shyfire131.net>
47 lines
1.2 KiB
Docker
47 lines
1.2 KiB
Docker
FROM ubuntu:focal AS final
|
|
FROM ubuntu:focal AS build
|
|
|
|
### Build stage
|
|
|
|
# Install curl and git and smp-related dependencies
|
|
RUN apt-get update && apt-get install -y curl git build-essential libgmp3-dev zlib1g-dev llvm llvm-dev libnuma-dev
|
|
|
|
# Install ghcup
|
|
RUN curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | BOOTSTRAP_HASKELL_NONINTERACTIVE=1 BOOTSTRAP_HASKELL_GHC_VERSION=8.10.7 BOOTSTRAP_HASKELL_CABAL_VERSION=3.6.2.0 sh
|
|
|
|
# Adjust PATH
|
|
ENV PATH="/root/.cabal/bin:/root/.ghcup/bin:$PATH"
|
|
|
|
# Set both as default
|
|
RUN ghcup set ghc 8.10.7 && \
|
|
ghcup set cabal
|
|
|
|
COPY . /project
|
|
WORKDIR /project
|
|
|
|
# Compile smp-server
|
|
RUN cabal update
|
|
RUN cabal install
|
|
|
|
### Final stage
|
|
|
|
FROM final
|
|
|
|
# Install OpenSSL dependency
|
|
RUN apt-get update && apt-get install -y openssl libnuma-dev
|
|
|
|
# Copy compiled smp-server from build stage
|
|
COPY --from=build /root/.cabal/bin/smp-server /usr/bin/smp-server
|
|
|
|
# Copy our helper script
|
|
COPY ./scripts/docker/entrypoint /usr/bin/entrypoint
|
|
|
|
# Open smp-server listening port
|
|
EXPOSE 5223
|
|
|
|
# SimpleX requires using SIGINT to correctly preserve undelivered messages and restore them on restart
|
|
STOPSIGNAL SIGINT
|
|
|
|
# Finally, execute helper script
|
|
ENTRYPOINT [ "/usr/bin/entrypoint" ]
|