docker: update and fix build (#3805)
This commit is contained in:
parent
edc5a4c31b
commit
bb1620d7d2
45
Dockerfile
45
Dockerfile
@ -1,32 +1,41 @@
|
|||||||
FROM ubuntu:focal AS build
|
ARG TAG=22.04
|
||||||
|
|
||||||
# Install curl and simplex-chat-related dependencies
|
FROM ubuntu:${TAG} AS build
|
||||||
RUN apt-get update && apt-get install -y curl git build-essential libgmp3-dev zlib1g-dev libssl-dev
|
|
||||||
|
### Build stage
|
||||||
|
|
||||||
|
# Install curl and git and simplex-chat dependencies
|
||||||
|
RUN apt-get update && apt-get install -y curl git build-essential libgmp3-dev zlib1g-dev llvm-12 llvm-12-dev libnuma-dev libssl-dev
|
||||||
|
|
||||||
|
# Specify bootstrap Haskell versions
|
||||||
|
ENV BOOTSTRAP_HASKELL_GHC_VERSION=9.6.3
|
||||||
|
ENV BOOTSTRAP_HASKELL_CABAL_VERSION=3.10.1.0
|
||||||
|
|
||||||
# Install ghcup
|
# Install ghcup
|
||||||
RUN a=$(arch); curl https://downloads.haskell.org/~ghcup/$a-linux-ghcup -o /usr/bin/ghcup && \
|
RUN curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | BOOTSTRAP_HASKELL_NONINTERACTIVE=1 sh
|
||||||
chmod +x /usr/bin/ghcup
|
|
||||||
|
|
||||||
# Install ghc
|
|
||||||
RUN ghcup install ghc 9.6.3
|
|
||||||
# Install cabal
|
|
||||||
RUN ghcup install cabal 3.10.1.0
|
|
||||||
# Set both as default
|
|
||||||
RUN ghcup set ghc 9.6.3 && \
|
|
||||||
ghcup set cabal 3.10.1.0
|
|
||||||
|
|
||||||
COPY . /project
|
|
||||||
WORKDIR /project
|
|
||||||
|
|
||||||
# Adjust PATH
|
# Adjust PATH
|
||||||
ENV PATH="/root/.cabal/bin:/root/.ghcup/bin:$PATH"
|
ENV PATH="/root/.cabal/bin:/root/.ghcup/bin:$PATH"
|
||||||
|
|
||||||
|
# Set both as default
|
||||||
|
RUN ghcup set ghc "${BOOTSTRAP_HASKELL_GHC_VERSION}" && \
|
||||||
|
ghcup set cabal "${BOOTSTRAP_HASKELL_CABAL_VERSION}"
|
||||||
|
|
||||||
|
COPY . /project
|
||||||
|
WORKDIR /project
|
||||||
|
|
||||||
# Adjust build
|
# Adjust build
|
||||||
RUN cp ./scripts/cabal.project.local.linux ./cabal.project.local
|
RUN cp ./scripts/cabal.project.local.linux ./cabal.project.local
|
||||||
|
|
||||||
# Compile simplex-chat
|
# Compile simplex-chat
|
||||||
RUN cabal update
|
RUN cabal update
|
||||||
RUN cabal install
|
RUN cabal build exe:simplex-chat
|
||||||
|
|
||||||
|
# Strip the binary from debug symbols to reduce size
|
||||||
|
RUN bin=$(find /project/dist-newstyle -name "simplex-chat" -type f -executable) && \
|
||||||
|
mv "$bin" ./ && \
|
||||||
|
strip ./simplex-chat
|
||||||
|
|
||||||
|
# Copy compiled app from build stage
|
||||||
FROM scratch AS export-stage
|
FROM scratch AS export-stage
|
||||||
COPY --from=build /root/.cabal/bin/simplex-chat /
|
COPY --from=build /project/simplex-chat /
|
||||||
|
Loading…
Reference in New Issue
Block a user